Developer Explains Memory Deallocation Using Pointer Arithmetic in C
A developer has published Part 3 of a series on manual memory allocation in C, focusing on implementing a function to free allocated memory. The article explains how a custom my_free() function uses pointer arithmetic to step back one struct-width in memory and mark a block as free. Central to the explanation is a 24-byte metadata struct, whose size is determined by padding rules on 64-bit architectures. The author uses mmap-based virtual memory for all examples and walks through how pointer subtraction reliably locates the metadata preceding any allocated user-space block. The piece is framed as a practical, fundamentals-focused guide rather than a showcase of novel techniques.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in