alloc_phase.SealedPhaseAllocator
Internal implementation documentation
Defined in alloc_phase.
Enforces strict lifecycle boundaries around a backing allocator by panicking whenever caller code attempts a raw operation outside the permitted phase.
Source
Source: lib/alloc/phase/src/allocator.zig:359
zig
/// Enforces strict lifecycle boundaries around a backing allocator by panicking/// whenever caller code attempts a raw operation outside the permitted phase./// During initialization, the guard permits all four raw operations:/// allocation, resizing, remapping, and freeing. Once sealed to the steady/// phase, every raw allocator call is considered a violation: the guard/// increments the corresponding violation counter and explicitly panics before/// dispatching to the backing allocator, never returning `error.OutOfMemory` to/// signal phase errors. During teardown, freeing remains permitted, but/// allocation, remapping, and resizing are treated as violations and panic,/// including requests that attempt to shrink existing allocations.////// The guard stores its state in a separately allocated control block, allowing/// wrapper copies and issued `std.mem.Allocator` handles to share the same/// lifecycle phase, counters, and backing allocator. Because `Allocator.ptr`/// references this shared control block directly, moving or copying the wrapper/// preserves issued handles. Lifecycle transitions occur through explicit calls/// to `seal`, `abortInitialization`, and `beginTeardown`, and any invalid or/// duplicate transition panics in all build modes. This guard intercepts only/// raw calls routed through its own handles: it does not observe global/// allocator usage, distinct allocator handles, operating system calls, or/// backing allocator internal operations. It enforces no startup allocation/// byte budget and provides no guarantee that runtime workloads fit/// preallocated memory.pub const SealedPhaseAllocator = PhaseAllocator(.panic);Source: lib/alloc/phase/src/root.zig:169
zig
/// Enforces strict lifecycle boundaries around a backing allocator by panicking/// whenever caller code attempts a raw operation outside the permitted phase./// During initialization, the guard permits all four raw operations:/// allocation, resizing, remapping, and freeing. Once sealed to the steady/// phase, every raw allocator call is considered a violation: the guard/// increments the corresponding violation counter and explicitly panics before/// dispatching to the backing allocator, never returning `error.OutOfMemory` to/// signal phase errors. During teardown, freeing remains permitted, but/// allocation, remapping, and resizing are treated as violations and panic,/// including requests that attempt to shrink existing allocations.////// The guard stores its state in a separately allocated control block, allowing/// wrapper copies and issued `std.mem.Allocator` handles to share the same/// lifecycle phase, counters, and backing allocator. Because `Allocator.ptr`/// references this shared control block directly, moving or copying the wrapper/// preserves issued handles. Lifecycle transitions occur through explicit calls/// to `seal`, `abortInitialization`, and `beginTeardown`, and any invalid or/// duplicate transition panics in all build modes. This guard intercepts only/// raw calls routed through its own handles: it does not observe global/// allocator usage, distinct allocator handles, operating system calls, or/// backing allocator internal operations. It enforces no startup allocation/// byte budget and provides no guarantee that runtime workloads fit/// preallocated memory.pub const SealedPhaseAllocator = allocator.SealedPhaseAllocator;Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |