• 2 min read

Zig made memory visible again

Questions about ownership and allocation that carry over to higher-level work.

Learning Zig made me pay attention to questions I could usually postpone: who owns this memory, how long does it live, and what happens if allocation fails?

Passing an allocator makes that dependency visible at the call site. Returning a slice raises questions about its backing storage. Error unions make me account for failure instead of assuming it will appear somewhere else later.

The useful part carries over to higher-level work. Reading a whole file into memory is convenient, but how large might the file be? A cache saves requests, but what keeps it bounded? A background task outlives the screen that started it, but who cancels it?

I still enjoy tools that handle memory for me. I just have a better sense of what they are handling, and where to look when the abstraction stops being cheap.

Zig is also a reminder that a small exercise can be worthwhile without becoming a production rewrite. I can learn from writing somewhere less forgiving and take those questions back to the software I already build.