C
You're viewing a free preview. Sign in free to read every script.
Why this exists malloc and free are general purpose: they must handle any size, any order, any lifetime. That generality has a cost in speed and in bookkeeping, and worse, a cost in your code: every object needs its own…
An Arena Allocator: Fast Allocation, One Free for Everything, and Alignment
Build a bump-pointer arena that hands out memory from one block, handle alignment correctly, release thousands of objects with a single call, and see the difference against per-object malloc measured with Valgrind.
Sign in free to read this script, along with the rest of the library.
Sign in free