BASS: the per-thread scratch arena

BASS is ABC's answer to malloc churn: a single per-thread, LIFO scratch arena that lives for the whole program, set up by MAIN / TEST / FUZZ at entry. Every call and try snapshots the arena's boundaries on the way in and rewinds them on the way out, so any scratch a procedure carves is freed automatically when control returns to its caller — no manual free, no leaks. Forked children inherit it copy-on-write. You acquire from it through a_-macros that wrap the underlying buffer-arena operations.

Acquiring scratch

Three macro families cover the cases: a writable buffer to fill, a gauge closed into a slice of exactly the right length, and a one-shot copy. Each acquires from BASS and needs no release.

Lifecycle and rules

BASS moves in lockstep with the call stack, which is what makes it both safe and free. A few rules keep that invariant intact; breaking one corrupts an in-flight allocation.