Skip to documentation
SLOP

alloc_arena.Arena

Reference alloc_arena Arena

Internal implementation documentation

Defined in alloc_arena.

Arena groups allocations under one caller-controlled lifetime and releases them together.

No direct callersNo direct callsalloc_arenaArena
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/alloc/arena/src/arena.zig:37

zig
/// `Arena` groups allocations under one caller-controlled lifetime and releases/// them together. When allocation observation is disabled, `Arena` aliases/// `std.heap.ArenaAllocator`. When observation is enabled through/// `-Dobserve-allocations=true`, it aliases `ObservedArena`, which wraps a/// standard arena with an observation identity. Both variants provide `init`,/// `allocator`, `deinit`, `queryCapacity`, `reset`, and the `ResetMode` union./// Standard library details such as `std.heap.ArenaAllocator.State`, `promote`,/// and concrete struct fields are not guaranteed when observation is active.////// The owner enforces no fixed byte or node capacity cap of its own, drawing/// fresh blocks on demand from a backing allocator. An `Allocator` handle/// returned by `allocator` stores a pointer back to the arena, requiring the/// caller to keep the arena owner at a stable memory address while using that/// handle. The caller must keep the backing allocator state alive until the/// arena and all allocated memory are torn down, but the small handle value/// itself can be copied freely.////// Calling `reset` or `deinit` ends the lifetime of all existing allocations at/// once and invalidates every slice previously handed out. The arena does not/// invoke destructors on individual objects before reclaiming storage, and/// physical release of memory to the operating system depends on the backing/// allocator.////// The allocation vtable is thread-safe when the backing allocator is/// thread-safe. In contrast, `reset` and `deinit` mutate internal state, and/// `queryCapacity` reads shared state without synchronization, requiring/// callers to exclude concurrent operations during those calls. When/// observation is active, the allocation vtable remains thread-safe if both the/// backing allocator and observation sinks support concurrent calls, but/// observation callbacks require their own synchronization.pub const Arena = if (observe.enabled)    ObservedArenaelse    std.heap.ArenaAllocator;

Source: lib/alloc/arena/src/root.zig:230

zig
/// Exports the primary arena allocator, which groups multiple allocations under/// a single caller-managed lifetime and supports resetting capacity for reuse./// At compile time, this alias resolves to ObservedArena when allocation/// observation is enabled and to std.heap.ArenaAllocator when disabled.pub const Arena = arena.Arena;

Audit

Definitions1
Public names1
Members0
Version26.7.0
Revisiondaab053ee433