Jeffrey M. Barber

Tombstone

ZHeap

Oct 2001 – Nov 2001 · age 19

What it was

A compacting memory allocator in one C++ class and a console test. The heap took one large allocation and carved it into three regions: a table of cells, a hash from handle ids to cells, and the data arena. Callers never held pointers. They held integer handles and asked the heap for the current address each time. Allocation was a bump pointer, freeing left holes, and when a request would not fit and something had been freed since the last pass, the heap slid every live block down with memmove and rewrote the table so every handle still resolved. The test filled six blocks with letters, freed one, printed the arena, compacted and printed it again so the shift was visible by eye. A benchmark against malloc and new was written, then commented out, and never run in the last build.

Wins, for the age

What it taught

Genealogy

Ancestors: Zenerd: the engine library whose handle-based heap this experiment isolated and tested. Descendants: Adama Caravan: bytes in one pre-sized heap, metadata held separately, two decades later.

Epitaph

Here lies ZHeap, which learned that if nobody holds a pointer, everything can move, and proved it once with six blocks of letters.