Expand description
Runtime memory accounting.
The accounting is intentionally explicit:
- allocations are charged when capacity is acquired;
- replacements release the old allocation;
Dropreleases the final allocation;- failed reservations never modify the current value.
Order for overwrite (S3):
reserve(new) → release(old) → install(new)Never install before releasing the previous charge. Peak usage during a
successful replace is therefore old + new until the old charge is
released — a same-size swap can fail against a tight ceiling even though
the steady-state footprint would fit.
§What this does not guarantee
HeapStr / HeapBytes charge buffers they own. Rust code that
builds a String / Vec before handing it to HeapStr::new has already
allocated; the budget only learns about that capacity after the fact.
RuntimeConfig::max_runtime_bytes is therefore a
runtime-managed accounting ceiling, not a global allocator sandbox.
Structs§
- Heap
Bytes - Opaque byte buffer charged against a
MemoryBudget. - HeapStr
- UTF-8 heap buffer charged against a
MemoryBudget. - Memory
Budget - Process- or scope-wide byte budget with atomic charge/release.
- Memory
Limit - Hard ceiling for a
MemoryBudget. - Memory
Snapshot - Point-in-time view of a budget (read-only observability).
Enums§
- Memory
Error - Fail-closed memory reservation error.