this repo has no description

[[zig.md]]

pub fn init(allocator: std.mem.Allocator) !GameData {
    var aa = std.heap.ArenaAllocator.init(allocator);
    return .{
        .arena_allocator = aa,
        .id_list = try aa.allocator().alloc(u64, 0),
        .model_list = try aa.allocator().alloc(Mesh, 0),
        .position_x_list = try aa.allocator().alloc(f64, 0),
        .position_y_list = try aa.allocator().alloc(f64, 0),
    };
}

pub fn deinit(self: *GameData) void {
    self.arena_allocator.deinit();
}

Use cases#

  • A short-lived scratch space storing intermediate results in a function, which is reset before/just after the function returns.
  • Long-lived “subsystem” arena which is used to allocate return values for the caller.
  • A permanent arena which is never freed.