Apex › Systems & OS

One block, one pointer (arena allocator)

The opposite of a general allocator: instead of free lists and per-object headers, an arena is one block and one bump pointer. alloc(n, align) rounds the pointer up to the alignment, returns it, and adds n — O(1), no search, no metadata. You never free one object; you reset the pointer to zero and the whole arena is free in one instruction. Perfect for request-, frame-, or pass-scoped memory (compilers, servers, games). Verified in node: allocations never overlap (44k across 3000 arenas), every one is aligned, out-of-memory is handled, reset reclaims all, and alignment padding is exact. Allocate objects and watch the pointer bump, then reset.

More in Systems & OS