typeover
curriculum

Curriculum Memory

module 3 of 4

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.


themes

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…

9 ready begin →

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…

9 ready begin →

ArrayList(T) is Zig's growable slice — your TypeScript Array equivalent. In Zig 0.16 it's an unmanaged container by API convention: you initialize with the .empty literal, pass the…

9 ready begin →

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…

9 ready begin →