alloc_phase.ObservingPhaseAllocator
Internal implementation documentation
Defined in alloc_phase.
Audits phase compliance across an application lifecycle by recording unauthorized raw operations in local counters and call site slots while forwarding those requests to the backing allocator.
Source
Source: lib/alloc/phase/src/allocator.zig:379
zig
/// Audits phase compliance across an application lifecycle by recording/// unauthorized raw operations in local counters and call site slots while/// forwarding those requests to the backing allocator. When a caller attempts/// an operation outside the permitted phase, the guard increments the/// corresponding violation counter, attempts to record the return address in/// one of 16 call site slots, and forwards the invocation to the backing/// allocator. If the backing allocator fails the request, the violation counter/// remains incremented because the attempt itself violated lifecycle rules.////// 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. This control block/// includes atomic return address slots, giving it a larger memory footprint/// than `SealedPhaseAllocator`. The guard enforces the same lifecycle rules as/// `SealedPhaseAllocator`, so invalid phase transitions, duplicate transitions,/// handle requests in the wrong phase, and premature deinitialization trigger/// an explicit panic in all build modes. This mechanism operates entirely/// through its own allocator handles and functions independently from/// `alloc_observe` event sessions.pub const ObservingPhaseAllocator = PhaseAllocator(.observe);Source: lib/alloc/phase/src/root.zig:135
zig
/// Audits phase compliance across an application lifecycle by recording/// unauthorized raw operations in local counters and call site slots while/// forwarding those requests to the backing allocator. When a caller attempts/// an operation outside the permitted phase, the guard increments the/// corresponding violation counter, attempts to record the return address in/// one of 16 call site slots, and forwards the invocation to the backing/// allocator. If the backing allocator fails the request, the violation counter/// remains incremented because the attempt itself violated lifecycle rules.////// 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. This control block/// includes atomic return address slots, giving it a larger memory footprint/// than `SealedPhaseAllocator`. The guard enforces the same lifecycle rules as/// `SealedPhaseAllocator`, so invalid phase transitions, duplicate transitions,/// handle requests in the wrong phase, and premature deinitialization trigger/// an explicit panic in all build modes. This mechanism operates entirely/// through its own allocator handles and functions independently from/// `alloc_observe` event sessions.pub const ObservingPhaseAllocator = allocator.ObservingPhaseAllocator;Audit
| Definitions | 1 |
|---|---|
| Public names | 1 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |