Allocator Model โ
Interface โ
Everything is expressed through std.mem.Allocator (verified against lib/std/mem/Allocator.zig in the 0.16.0 SDK): alloc / resize / remap / free plus the convenience wrappers (alloc, dupe, alignedAlloc, free).
Containers โ
- Unmanaged
std.ArrayList(T)(.empty, methods takinggpa) backs every growable buffer: stacks, pools, scratch, matches. - Managed
std.StringHashMap/AutoHashMapare available for maps; the hot paths avoid hashing entirely. std.heap.ArenaAllocatorwraps batch workloads; the library'smemory.Arenaaddsreset/queryCapacityconveniences.
Rules enforced by tests โ
- One handoff (
Parser.init); inheritance everywhere else. - No
std.heap.page_allocatorfallback, no global singleton, no per-operation allocator parameters on the hot path. OutOfMemorypropagates with partial state cleaned up (failing-allocator tests).std.testing.allocatoracross the suite means any leak fails CI.
