Why Zig Has No Hidden Allocations
Allocation is always passed in.
Memory Is Explicit
In Zig, no standard library function quietly grabs heap memory. If code needs to allocate, it must say so out loud. 📦
You Pass the Allocator
Anything that allocates takes an allocator as a parameter. Memory cannot appear unless you hand a function the tool to make it.
fn buildList(allocator: std.mem.Allocator) !void {}All lessons in this course
- Why Zig Has No Hidden Allocations
- The Allocator Interface
- alloc, free, create, destroy
- Dynamic Lists with ArrayList