Buffers: own a range as past, live, free

A buffer is four pointers dividing one memory range into three slices: PAST (consumed), DATA (live), and IDLE (free). Feeding appends to DATA out of IDLE; draining consumes DATA into PAST; each move grows the adjoining slice, so a buffer tracks its own fill level and no length ever travels beside it. A buffer owns its backing memory heap, mmap, arena, or stack and the verb that created it decides who frees it. Pass a buffer down the call stack by pointer; never copy one.

The three slices

buf[0..3] bound PAST [0,1), DATA [1,2), and IDLE [2,3). Reads and writes move the inner borders, so the buffer always knows what is live and what is free.

Ownership

A buffer's backing comes from exactly one source, and you release it with the matching verb. Provenance lives in the caller's head, not the buffer's type match create to release at every site.

Buffers as arenas

A buffer can dispense slices to other code, LIFO along the call tree. This removed most need for malloc: build records in place, then rewind to reclaim them all at once.