Zig allocators in C (educational)

Hi!

I’m new to Zig. The most confusing aspect of Zig is the allocators. (Eg. “Why do I need to pass allocators around?”)

In the spirit of “what I cannot build I do not understand,” I implemented Zig’s allocators in C.

Here’s the link: zalloc/main.c at master · pixqc/zalloc · GitHub

I learned so much by making this! I’m now more aware of how my Zig program allocates and frees memory.

Just wanted to share what I’ve worked on. Please leave feedback and criticism if you have any!

16 Likes