Skip to documentation
SLOP

tiny.alloc

Reference tiny.alloc

Overview · API · Code relationships · Verification · Audit

Overview

The package decides which allocator a program's long-lived storage comes from, and it holds the byte ceiling a caller can put in front of an allocator. The single allocator a program's long-lived storage comes from, chosen when the program is compiled, is the process allocator. The parts of a program that live as long as the process take the storage they need while it starts up.

The process sits in one stage of its life at a time, its phase, one of initialization, steady state, or teardown. The startup stage, in which allocation is expected, is initialization. The call that ends initialization and moves the process to steady state is the seal, executed by sealProcessAllocatorPhase. The stage after the seal, in which an allocation counts as a violation, is steady state. One allocator operation that arrived in a phase which forbids it is a violation.

The build setting that decides what happens to a violation, one of off, observe, or seal, is the process phase mode. Under the seal build setting, an allocation, a resize, or a remap that arrives after the seal panics and is refused, and a free is refused the same way. Under the observe setting, the same operation is counted, the return address of the call that violated is kept as the violation site, and the operation goes through. A free during teardown counts as no violation, so a program can release its startup storage.

The allocator that checks a byte ceiling of its own before asking the allocator behind it for anything is the limit allocator, implemented as LimitAllocator. That ceiling bounds how far the memory behind it can grow. LimitAllocator reports its own refusal, AllocationLimitExceeded, apart from the backing allocator's OutOfMemory, so a caller can tell a configured ceiling from a machine running out of memory.

Definitions

Actions

Public operations.

Types and contracts

Public types and contracts.

Values and defaults

Public values and defaults.

Code relationships

Direct static dependencies extracted from parsed source by semantic graph analysis.

Uses: tiny.bumpalo, tiny.deadalloc, tiny.gpalloc, tiny.sys
Used by: tiny.glom, tiny.http, tiny.profiling, tiny.smg, tiny.tldr

Verification

No verification records are cataloged for this module in this build.

Audit

EvidenceValue
Sourcelib/alloc/src/root.zig
Definitions4 of 27 documented
Members0 of 0 documented
Public names27 API, 33 indexed
Version26.7.0
Revisiondaab053ee433
Unresolved targets3