typeover
curriculum

Curriculum Memory Allocators (intro) exercise 3 · mcq

Allocators (intro)

An ArenaAllocator wraps another allocator and tracks every allocation so they can ALL be freed in one shot via arena.deinit(). Pick the right setup.

TypeScript reference
Pick the idiomatic Go translation

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.