Curriculum Memory
Memory
The friction module. Allocators are explicit: every dynamic allocation goes through one, and you pick which. defer is the structural tool that makes manual memory safe to write (and read). Ownership is enforced by convention, not the compiler — "whoever calls init calls deinit." Once comfortable here, the rest of the Zig stdlib reads naturally.
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, sim…
defer is Zig's structural cleanup tool: each defer statement runs when the enclosing block exits, in LIFO order. errdefer is the same idea, but it only fires when the function retu…
Zig has no borrow checker — ownership is convention, not enforcement. The rule that makes manual memory livable: whoever calls init is responsible for calling deinit. A function th…