How to Allocate Memory
Summary
The article advocates rethinking memory allocation beyond standard malloc/free to unlock substantial performance gains. It discusses allocating at more granular levels (pages, stacks, arrays, objects) and proposes per-structure allocators (e.g., separate allocators for different data usage patterns), along with examples of page and array management, free lists, and a buddy-allocator approach. The piece emphasizes memory layout, fragmentation avoidance, and manual strategies to reduce allocation overhead and improve throughput in performance-critical codebases.