this repo has no description
1[[zig.md]]
2
3```zig
4pub fn init(allocator: std.mem.Allocator) !GameData {
5 var aa = std.heap.ArenaAllocator.init(allocator);
6 return .{
7 .arena_allocator = aa,
8 .id_list = try aa.allocator().alloc(u64, 0),
9 .model_list = try aa.allocator().alloc(Mesh, 0),
10 .position_x_list = try aa.allocator().alloc(f64, 0),
11 .position_y_list = try aa.allocator().alloc(f64, 0),
12 };
13}
14
15pub fn deinit(self: *GameData) void {
16 self.arena_allocator.deinit();
17}
18```
19
20## Use cases
21
22- A short-lived scratch space storing intermediate results in a function,
23 which is reset before/just after the function returns.
24- Long-lived “subsystem” arena which is used to allocate return values for
25 the caller.
26- A permanent arena which is never freed.