Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Union

ResetMode

Public Union
std.heap.ArenaAllocator.ResetMode
pub const ResetMode = union(enum)

Fields

free_all: free_all

Releases all allocated memory in the arena.

retain_capacity: 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.

File

heap/ArenaAllocator.zig:86
86
87
88
89
90
91
92
93
94
95
96
97
98
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,
}