pub struct Footprint {
pub bytes: u64,
pub shared_bytes: u64,
pub entries: u64,
}Expand description
A deterministic byte estimate for the memory a subscription’s engine retains.
docs/05-tier-lowering.md §5.3 names per-session memory as one of three metrics to export,
and Phase 0’s kill gate is written in kilobytes per idle session
(docs/18-phase-0-report.md §18.3). An engine per subscription is a memory-for-time trade,
so the number has to exist.
It is computed rather than sampled. A resident-set reading moves with the allocator’s arena and
swung by 2× between runs of the same measurement; a counting allocator would be exact and needs
unsafe, which this workspace forbids. So this walks what is actually retained and adds up
size_of plus the bytes behind each allocation, counting shared structure once: a Todo an
arrangement holds is the same Arc the accumulator holds, and charging a subscription for it
would be the difference between “a handle per row” and “a row per row”.
What it excludes, and therefore under-reports: allocator overhead per allocation, which for many small allocations is substantial. It is a floor on the true cost, not a ceiling.
Fields§
§bytes: u64Bytes retained by this engine’s cells, arrangements and keys.
Of those, the ones in arrangements that do not read the session — what §5.3 says a thousand subscribers should hold once between them, and this engine holds once each.
entries: u64