Curriculum Memory Allocators (intro) exercise 2 · mcq
Allocators (intro)
When the allocation has a known maximum size and you don't
want to touch the heap, use a FixedBufferAllocator over a
stack-allocated buffer. Pick the right setup.
TypeScript reference
About this theme
Zig has no hidden allocations. Every dynamic alloc goes through an Allocator interface value, and you pick which. The three you meet first: page_allocator (OS page granularity, simple, no bookkeeping), FixedBufferAllocator (a slice of memory you supply, zero heap), and ArenaAllocator (deferred mass-free — drop everything on deinit). The Allocator interface is uniform: alloc, free, dupe, realloc. Pick the allocator that matches the lifetime you want.