This allocator takes an existing allocator, wraps it, and provides an interface where you can allocate without freeing, and then free it all together.

Fields

child_allocator: Allocator,
state: State,

Functions

fn allocator(self: *ArenaAllocator) Allocator

No documentation provided.

fn deinit(self: ArenaAllocator) void

No documentation provided.

fn init(child_allocator: Allocator) ArenaAllocator

No documentation provided.

fn queryCapacity(self: ArenaAllocator) usize

Queries the current memory use of this arena. This will not include the sto…

Queries the current memory use of this arena. This will not include the storage required for internal keeping.

fn reset(self: *ArenaAllocator, mode: ResetMode) bool

Resets the arena allocator and frees all allocated memory.

Resets the arena allocator and frees all allocated memory.

mode defines how the currently allocated memory is handled. See the variant documentation for ResetMode for the effects of each mode.

The function will return whether the reset operation was successful or not. If the reallocation failed false is returned. The arena will still be fully functional in that case, all memory is released. Future allocations just might be slower.

NOTE: If mode is free_mode, the function will always return true.