alloc, free, create, destroy
The core allocator operations.
Four Core Operations
An allocator gives you four key calls: alloc and free for many items, create and destroy for a single value.
alloc Returns a Slice
Use alloc to request a run of items. You pass the element type and a count, and you get back a slice of that many elements.
const buf = try a.alloc(u8, 64);All lessons in this course
- Why Zig Has No Hidden Allocations
- The Allocator Interface
- alloc, free, create, destroy
- Dynamic Lists with ArrayList