Tagged articles
malloc
52 articles · Page 1 of 1
The article explains why high‑concurrency programs suffer from memory fragmentation and system‑call overhead, compares memory pools and object pools, outlines their distinct use‑cases, provides step‑by‑step C and C++ implementations, and highlights optimization tips and common pitfalls.
C++high concurrencymalloc
0 likes · 20 min read

This comprehensive guide explains the inner workings of the C malloc function, covering memory layout, stack vs heap, glibc memory pools, system calls like brk/sbrk and mmap, allocation strategies, fragmentation, alignment, multithreading safety, and comparisons with calloc, realloc, and C++ new.
c-programmingglibcheap management
0 likes · 53 min read

This guide explains Linux's virtual‑physical memory model, shows how to inspect system and process memory via /proc files, demonstrates a 100 MiB allocation test, and provides a step‑by‑step workflow—including ps sorting and Valgrind usage—to locate and fix memory leaks.
DebuggingLinuxMemory Leak
0 likes · 16 min read

Even when a C++ program appears to run correctly, writing beyond allocated memory can corrupt heap metadata, causing a delayed crash at free(); this article explains the underlying malloc/free mechanisms, demonstrates the issue with code examples, and offers debugging tools and defensive programming practices to prevent such errors.
C++DebuggingHeap
0 likes · 9 min read

This article explains the low‑level mechanisms of brk and mmap in Linux, compares their characteristics, shows why malloc selects one over the other based on allocation size, and provides practical code examples, performance tips, and common pitfalls for developers.
Linuxbrkmalloc
0 likes · 29 min read

This article demystifies Linux process memory by explaining the layered architecture of virtual and physical memory, the role of the MMU and page tables, dynamic allocation mechanisms such as brk and mmap, and practical tools for inspecting and optimizing memory usage.
LinuxMMUSecurity
0 likes · 47 min read

This article explains the core differences between C's malloc/free and C++'s new/delete, covering allocation mechanisms, object construction and destruction, error handling, common pitfalls, and best practices—including smart pointers—to help developers choose the right memory management approach for various programming scenarios.
C++allocationmalloc
0 likes · 32 min read

This article explains the fundamental differences between C's malloc/free and C++'s new/delete, covering their underlying mechanisms, proper usage patterns, common pitfalls, error‑handling strategies, and best‑practice recommendations such as smart pointers and memory‑pool techniques.
C++mallocmemory management
0 likes · 29 min read

This article explains C++ memory management fundamentals, detailing how delete and free release memory without explicit size knowledge, the role of stack, heap, data and code segments, differences between new/delete and malloc/free, array handling, common pitfalls, and interview questions with code examples.
C++DELETEHeap
0 likes · 34 min read

This article explains the fundamentals of malloc and free, covering their signatures, how they interact with the brk/sbrk system calls, the structure of memory control blocks, multiple allocation strategies such as explicit free lists, segregated lists, buddy systems and tcmalloc, along with code examples and their trade‑offs.
Dynamic Memoryc-programmingfree
0 likes · 15 min read

This comprehensive guide delves into C++ polymorphism, dynamic memory allocation with malloc, Linux memory management, concurrency techniques, and database fundamentals, providing high‑frequency interview questions and practical code examples to help candidates excel in competitive tech recruitment.
C++ConcurrencyPolymorphism
0 likes · 53 min read

This article explains how using mmap for shared memory in C/C++ can break process isolation, introduce permission‑related code‑injection vulnerabilities, and cause multithreading synchronization issues, making it a riskier choice than the traditional malloc allocation.
C++Shared Memorymalloc
0 likes · 5 min read

This article examines the internal design of glibc’s ptmalloc, explains how malloc_state, malloc_chunk, fastbins, bins and the top chunk work, analyzes lock contention and memory fragmentation in multithreaded scenarios, and presents a C benchmark that measures these performance issues.
C++freemalloc
0 likes · 12 min read

This article examines the inner workings of glibc’s ptmalloc, explains how malloc_state, malloc_chunk, fastbins and bins manage memory, and presents a multithreaded test that reveals lock contention and fragmentation problems that make the standard malloc/free unsuitable for high‑performance scenarios.
C++freemalloc
0 likes · 13 min read

mmap shared memory lets multiple processes access the same physical memory, which can break process isolation, expose permission misconfigurations like PROT_EXEC, and cause cross‑process crashes or code‑injection attacks, making it far riskier than heap allocations with malloc that remain confined to a single process.
SecurityShared Memoryc-programming
0 likes · 5 min read

This comprehensive guide explores Linux's memory management ecosystem, detailing user‑space allocators like malloc, kernel‑space mechanisms such as kmalloc, vmalloc, and mmap, and core kernel algorithms including the Buddy system, CMA, slab allocator, and memory pools, while providing code examples and practical usage tips.
Buddy AlgorithmLinuxkmalloc
0 likes · 60 min read

This article provides a comprehensive overview of glibc's heap memory management, explaining the role of brk and mmap, the organization of arenas, heaps, chunks, bin structures, allocation and deallocation strategies, and how these concepts are applied in security research and exploit development.
C++freeglibc
0 likes · 29 min read

This article provides a comprehensive overview of heap memory management in C, explaining the concepts of heap versus stack, the usage and internal mechanisms of malloc and free, common pitfalls such as memory leaks and dangling pointers, and compares these functions with new/delete, calloc, and realloc.
C++Heapfree
0 likes · 29 min read

This article explains the role of glibc malloc in dynamic memory allocation, describes its internal data structures and allocation/free algorithms, provides a C code example, and offers practical optimization tips and common pitfalls for safe and efficient memory management.
c-programmingdynamic allocationglibc
0 likes · 13 min read

This article explains how memory works as a temporary storage stage for processes, describes the fundamentals of physical and virtual memory, details paging, page tables, multi‑level paging, allocation mechanisms such as brk() and mmap(), and outlines Linux memory‑management techniques including caching, swapping, and OOM handling.
MMUOOMmalloc
0 likes · 33 min read

This article explains why dynamic memory allocation is essential, models the heap as a parking lot, outlines the core challenges of implementing malloc and free, describes block headers, explores First Fit, Next Fit, and Best Fit strategies, and details splitting, internal fragmentation, and efficient coalescing using footers.
Systems Programmingallocation strategiesfragmentation
0 likes · 17 min read

This article explains how the C functions malloc and free allocate and release memory, covering stack vs heap, the brk and mmap system calls, fragmentation, header metadata, and why both allocation strategies are needed for efficient memory management.
Heapbrkc-programming
0 likes · 17 min read

This guide walks through creating a 32‑bit Linux‑kernel memory allocator using a free‑list, implementing morecore and add_to_free_list functions, and then adding a basic mark‑and‑sweep garbage collector that scans heap, BSS, data segments and the stack to reclaim unused blocks.
Linux kernelMark‑Sweepc-programming
0 likes · 12 min read

This article explains the Linux kernel’s memory management for a process, covering virtual address spaces, page‑fault handling, VMA allocation, stack and heap initialization, sbrk/brk usage, thread‑stack creation, and the glibc ptmalloc heap allocator with concrete code examples and diagrams.
HeapLinuxmalloc
0 likes · 15 min read

This article explains the purpose, prototype, and usage of C's malloc function, delves into its underlying implementation using free‑list mechanisms, virtual‑memory translation, system calls like brk and mmap, and compares it with related functions such as calloc, realloc and new, while providing practical code examples and best‑practice guidelines.
C++Dynamic Memoryfree
0 likes · 32 min read

This article explains how the Linux kernel implements heap memory management, covering the heap data structure, the mm_struct fields start_brk and brk, the brk/sbrk and malloc/free allocation methods, the brk and mmap system calls, and the internal glibc structures heap_info and malloc_state that track heap state.
Linuxbrkheap memory
0 likes · 17 min read

The article dissects glibc's ptmalloc implementation, explaining malloc_state, malloc_chunk, fastbins, bins, and top chunk, then analyzes lock contention and fragmentation in multithreaded scenarios through a custom stress test, and concludes with recommendations for high‑performance memory management.
Concurrencyglibchigh-performance
0 likes · 12 min read

This article explains why memory leaks occur only with heap allocations in C, describes how malloc and related functions allocate memory, outlines two common ways to obtain heap memory, identifies the three essential elements of a leak, debunks common freeing misconceptions, and provides practical inspection steps to prevent leaks.
C++DebuggingHeap
0 likes · 6 min read

This article explains why calling malloc in C only reserves virtual address space, how the kernel maps it to physical memory on demand, and the roles of the brk pointer, memory layout, and page‑fault handling, illustrated with a 1 GB allocation example and detailed diagrams.
brkc-programmingmalloc
0 likes · 7 min read

This article explains what happens inside a computer when you request memory with malloc, covering the role of the standard library, the compilation and linking process, memory layout, heap allocation, fragmentation, and how the operating system expands the heap.
Heapc-programmingmalloc
0 likes · 6 min read

This article explains what happens inside a computer when you request memory with malloc, covering the C standard library, compilation, memory layout, heap allocation, fragmentation, and how the operating system expands the heap using system calls.
Heapc-programmingfragmentation
0 likes · 6 min read

This article explains how memory allocation works in C, covering the role of malloc, the distinction between code and user data, the compilation and linking process, heap organization, fragmentation, and how the operating system expands the heap when needed.
Heapc-programmingfragmentation
0 likes · 6 min read

The article explains C’s memory allocation, detailing how functions like malloc obtain heap space, the role of system calls such as brk, the distinction between stack and heap, address layout, fragmentation challenges, and practical implications for efficient dynamic memory management.
Heapc-programmingmalloc
0 likes · 5 min read

This guide explains how to allocate, initialize, resize, and release heap memory in C using malloc, calloc, realloc, free, and memset, with detailed code examples and tips for avoiding memory leaks.
C++Dynamic Memorycalloc
0 likes · 7 min read

This guide explains how to allocate, initialize, resize, and release heap memory in C using malloc, calloc, realloc, memset, and free, with clear examples, common pitfalls like memory leaks, and best‑practice recommendations for safe memory management.
C++callocfree
0 likes · 9 min read

This article explains how the glibc malloc implementation (ptmalloc) manages memory by using arenas, chunks, and various bin structures such as fastbins, smallbins, largebins, and unsorted bins, and describes the step‑by‑step allocation process performed by public_mALLOc and its helper functions.
Heapglibcmalloc
0 likes · 14 min read

This article explains the principles and usage of dynamic memory allocation in C/C++ (malloc, calloc, realloc, free, new, delete), compares their behaviors, demonstrates common pitfalls, and extends the discussion to Linux kernel memory statistics, cache handling, swappiness tuning, and garbage‑collection concepts.
C++Linuxfree
0 likes · 31 min read

This article explains Linux's flexible memory allocation system, covering user‑space malloc, kernel‑space kmalloc, vmalloc for large buffers, mmap for file and anonymous mappings, page allocation functions, the slab allocator, and memory pools, with detailed code examples and operational insights.
Linuxkmallocmalloc
0 likes · 30 min read

This guide explains typical C memory‑allocation errors, practical ways to avoid them, and introduces a lightweight logging system that automatically records allocations and frees to help developers detect memory leaks during debugging.
C++DebuggingDynamic Memory
0 likes · 8 min read

This article examines Linux memory management fundamentals, explains the brk/sbrk and mmap system calls, details the internal architectures, allocation and reclamation processes of ptmalloc and tcmalloc, analyzes key configuration parameters, and presents benchmark and production‑level results that demonstrate their impact on performance and memory usage.
BenchmarkLinuxTCMalloc
0 likes · 32 min read

This article investigates the performance degradation caused by DPDK memory fragmentation, explains the underlying heap and element management, presents detailed profiling and test results, and proposes two practical solutions that dramatically reduce allocation latency and improve overall system throughput.
C++DPDKmalloc
0 likes · 16 min read

This article explains how C programs allocate, resize, initialize, and transfer memory using functions like malloc, free, realloc, memset, memcpy, memmove, and alloca, and provides coding standards to avoid out‑of‑bounds errors, leaks, and use‑after‑free bugs.
C++Memcpymalloc
0 likes · 11 min read

This article explains Linux's virtual address space layout, the six user‑space memory segments, how malloc decides between brk and mmap based on allocation size, the behavior of free, and why both allocation methods are needed for performance and memory management.
HeapLinuxSystem Programming
0 likes · 13 min read

The article explains how glibc’s default ptmalloc allocator structures memory into main and non‑main arenas, uses chunk‑based bins (fast, unsorted, small, large) for allocation and deallocation, details its locking and OS‑interaction mechanisms, and evaluates its design trade‑offs versus modern allocators.
C++Linuxfree
0 likes · 12 min read

This article examines the design goals, key implementation details, strengths and weaknesses of four widely used memory allocators—dlmalloc, jemalloc, Scudo, and PartitionAlloc—highlighting how they address fragmentation, performance, and security in virtual‑machine runtimes and offering guidance for building efficient, safe allocators.
Scudodlmallocjemalloc
0 likes · 27 min read

A low‑overhead monitoring solution for iOS apps resets the global malloc_logger to capture every allocation, filters large allocations exceeding a configurable threshold, records lightweight stack traces using dyld image maps, and sends address‑only data for offline symbolication, enabling developers to identify and fix memory‑heavy code, reducing OOM crashes.
OOMiOSmalloc
0 likes · 14 min read


ITPUBJan 27, 2022 · Fundamentals
This article explains the reasons behind Linux's sophisticated memory management, covering virtual memory mechanisms, page tables, MMU/TLB interactions, page fault handling, the layout of a process's address space, glibc's malloc internals, memory reclamation techniques, and the OOM killer's decision process.
LinuxOOMkernel
0 likes · 33 min read

This article explores the inner workings of Linux's glibc malloc, detailing how heap memory is requested from the kernel, how multithreaded support is implemented with per‑thread arenas, and the structures such as arenas, bins, and chunks that together determine allocation efficiency.
LinuxMemory AllocatorMultithreading
0 likes · 26 min read

Although malloc is a universal allocator, its lack of scenario-specific optimization makes it unsuitable for high‑performance server applications; this article explains malloc’s internal workflow, compares it with custom memory‑pool techniques, and details various pool designs, thread‑safety strategies, and an interesting cross‑thread free problem.
C++backend developmentmalloc
0 likes · 14 min read


ITPUBSep 15, 2017 · Fundamentals
This article explains Linux's two‑level memory model, lazy physical allocation, the glibc malloc implementation, chunk metadata, large‑vs‑small allocations, memory holes, debugging hooks, leak detection with mtrace, and practical ways to measure a process's memory usage via /proc.
Debuggingglibcmalloc
0 likes · 15 min read

This article analyzes the nano_free crash issue that appeared on iOS 10.0‑10.1.1, explores several attempted fixes such as dylib replacement, source compilation, environment variable tweaks, and hook strategies, and finally proposes a guarded zone solution to reduce crash probability.
crashiOSmalloc
0 likes · 11 min read

This article examines typical C/C++ memory problems, classifying them into memory leaks and performance issues caused by fragmentation, explains root causes such as lost pointers, improper releases, unbounded allocations, and provides diagnostic examples and mitigation strategies using memory pools like tcmalloc.
C++DebuggingTCMalloc
0 likes · 13 min read
