Blog

How a C allocator packs the allocated flag into a block size
See why aligned block spans leave low bits free, pack the allocation state into one header word, and decode it without losing the size.
Can an unsigned char array implement malloc?
An unsigned char array can back a byte-oriented arena, but alignment alone does not make it portable malloc storage for arbitrary typed C objects.

Coalescing free blocks: memory neighbours, not free-list neighbours
Learn which free blocks can merge, how to update an explicit free list safely, and which tests catch stale entries and missed coalescing.

When to split a free block in a C memory allocator
Calculate an allocator’s minimum split remainder, account for headers and alignment, and test the boundary with a small C sizing function.
How to write a small memory allocator in C
Build a small C allocator model with block metadata, first-fit traversal, safe splitting and adjacent-block coalescing, plus a checked byte-layout diagram.
C allocator alignment: payload and next block
See why a C allocator aligns payload offsets and block spans, follow the 24/13/16 example, and run fixed C11 checks in your browser.
