Hi all, sorry if this has been asked before. I’m a C++ developer and as a first simple project to learn zig I’m making a simple 2D game using SDL. One thing that still isn’t clear for the language is where exactly an allocator should be created (to follow the usual way of doing things). I know that it’s pretty common for games to have more than one allocator type, such as a general allocator and an ArenaAllocator and they can be declared in different places.
But, for example, for a general allocator used to create std.ArrayList inside my game, should it be instantiated at the main() body and then passed to my Game object? For example Game.init(allocator)? In this case should the Game keep a copy or pointer to the allocator? Would it make more sense to create the allocator within a “manager” class or something like that?
I know this type of question has many answers, and that’s fine. I just would like to know what’s the usual way to do it in Zig.
Thanks a lot for the help!