unionstd.heap.arena_allocator.ArenaAllocator.ResetMode[src]

Fields

free_all

Releases all allocated memory in the arena.

retain_capacity

This will pre-heat the arena for future allocations by allocating a large enough buffer for all previously done allocations. Preheating will speed up the allocation process by invoking the backing allocator less often than before. If reset() is used in a loop, this means that after the biggest operation, no memory allocations are performed anymore.

retain_with_limit: usize

This is the same as retain_capacity, but the memory will be shrunk to this value if it exceeds the limit.

Source Code

Source code
pub const ResetMode = union(enum) {
    /// Releases all allocated memory in the arena.
    free_all,
    /// This will pre-heat the arena for future allocations by allocating a
    /// large enough buffer for all previously done allocations.
    /// Preheating will speed up the allocation process by invoking the backing allocator
    /// less often than before. If `reset()` is used in a loop, this means that after the
    /// biggest operation, no memory allocations are performed anymore.
    retain_capacity,
    /// This is the same as `retain_capacity`, but the memory will be shrunk to
    /// this value if it exceeds the limit.
    retain_with_limit: usize,
}