# Zig Level 3: Allocators

> Level 3: Allocators of the LoWisa Zig course: Explicit Allocation, Allocator Interfaces, Designing Memory Ownership. 3 lessons and 9 ideas, each explained in one line.

Allocators is level 3 of 11 of the [LoWisa Zig course](/courses/zig/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Explicit Allocation

- **The allocator parameter.** Anything allocating takes an **allocator** argument: heap use visible in every signature.
- **alloc and free.** Memory returns through **alloc** and leaves through free: with defer pairing them on the same screen.
- **No global allocator.** Zig ships no blessed **global** allocator: the choice is yours, per program, per subsystem.

## Allocator Interfaces

- **The Allocator interface.** **Allocator** is a standard interface: code written against it runs on any strategy.
- **GeneralPurposeAllocator.** The **general**-purpose allocator detects leaks and use-after-free in debug: a sanitizer built in.
- **Arenas and fixed buffers.** **Arena** allocators free everything at once; fixed buffers allocate from a stack array: strategies as values.

## Designing Memory Ownership

- **Ownership documented.** APIs document who **frees**: the caller, the callee, or the arena that outlives both.
- **Arena per task.** Request-scoped work uses an **arena**: allocate freely, free once, leaks impossible by shape.
- **Testing allocators.** Tests run under the **testing** allocator: leaks and double-frees failing the suite loudly.

## Before and after this level

- **Before:** [Level 2: Pointers & Memory](/courses/zig/level-2-pointers-and-memory/): Pointers, Slices, Memory Representation.
- **Next:** [Level 4: Structs, Enums & Unions](/courses/zig/level-4-structs-enums-and-unions/): Structs, Enums, Tagged Unions.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Zig Level 3: Allocators cover?

Explicit Allocation, Allocator Interfaces, Designing Memory Ownership: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 2: Pointers & Memory, which covers Pointers, Slices, Memory Representation.

## Learn Zig on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/zig/level-3-allocators/ · Updated 2026-11-25
