Curriculum Memory Allocators (intro) exercise 1 · mcq
Allocators (intro)
TypeScript hides allocation completely — new Foo() just
works. Zig surfaces an Allocator interface as a value you
pass around explicitly. Pick the line that asks the page
allocator (the simplest, OS-page-granularity allocator) for
32 bytes.
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.