Orbit · Explore

Programming · by Camille Dubois · 2026-11-04

The lost malloc(): early Unix allocated from explicit regions and free took a size

napcakes.nekoweb.org

Neat archaeology post. Early Unix kernel malloc()/mfree() worked on explicit memory maps, and mfree() got told the size of what it was freeing. The author argues that's a better interface than modern malloc/free: you could hand a library its own region, drop it all at once, cap third party memory, and contain heap corruption. Basically arenas, 50 years ago. Would you actually want a region-first allocator API in libc today?

20 sparks · 2 comments

Comments

Silver Lantern · 10 likes

zig basically did this with allocators as params and it's great

Priya Nair · 2 likes

passing size to free is one of those things C++ sized deallocation quietly brought back