News for hackers. Stuff that matters.
Re:What is malloc doing, anyway? by schmichael on Monday November 09, 2026 @04:41PM (#50432645)
mmap is covered later on, and as an introduction to heap memory management this seems like the right place to start. jemalloc and mimalloc build upon the fundamentals explained here.

What I'd love is for an article that goes a step back in allocator theory instead of "forward" to jemalloc/mimalloc. Optimal resource allocation has a rich history in pre-computer fields whose general theories are applicable today. Replace "linear memory" with "paper roll" and "types" with "items", and instead of malloc you have the cutting stock problem! https://en.wikipedia.org/wiki/Cutting_stock_problem

The reason why allocator fundamentals are important is because there is no universally optimal solution. jemalloc "emphasizes fragmentation avoidance and scalable concurrency support" while mimalloc focuses on a bounded worst-case allocation latency. Meanwhile if you're writing extremely memory constrained code for certain embedded systems, you may still be best off using a simple bump allocator with no free! https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98... The optimal resource allocation strategy is always use case dependent.

Re:What is malloc doing, anyway? by nayuki on Monday November 09, 2026 @05:26PM (#50433181)
> Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention.

I would argue that the missile performs the ultimate in physical garbage creation at the end of its flight.

Re:What is malloc doing, anyway? by cadamsdotcom on Monday November 09, 2026 @06:33PM (#50433909)
Whoosh