u/jackdbdin r/Zig • Recommends
On “What is a allocator anyway?”
Think about these questions:
1. how much memory to allocate?
2. when to allocate it?
3. what to do when memory allocation fails?
The answers to these questions are platform and architecture specific, and since one of the design goal of zig is to be compilable for any architecture, it cannot answer these questions for you. It's up to you to define an allocation strategy (i.e. answer to the questions above).
Zig defines an interface that you can implement to allocate/deallocate memory. And in order to cover common use cases, Zig also provides several implementations of that interface. But since Zig exposes such interface to you, you always have the option to allocate/deallocate memory howev…