To give you an idea of what’s common, there is only one instance in the entire Zig codebase (compiler, standard library, and tests) where a pointer to Allocator
is used, and it’s not even the real std.mem.Allocator
: test/cases/compile_errors/method_call_with_first_arg_type_wrong_container.zig
(I searched using the regex \*(const )?(std\.)?(mem\.)?Allocator
)
And this one instance is very likely a leftover from before “Allocgate”:
- 0.9.0 Release Notes ⚡ The Zig Programming Language
- Allocgate is coming in Zig 0.9, and you will have to change your code
So, std.mem.Allocator
is always passed by value in the Zig codebase.