AllocatorMemory
What a FairShareAllocator remembers between calls, as a value: the wake clamps it has computed, the demanding state each edge was last observed in (design §7.2, issues #1695, #1714), and each parent's net-service clock with the departures read against it (#3376).
A scheduler that runs in one process and outlives a restart needs this. Without it a restarted allocator has observed nothing, so every seated child it finds asking is a waker it clamps to the front, plus its edge's outstanding (the restart rule, design §7.2, #3238, #3721). That denies idle credit, but it costs every such child its lag: a child that paused just before the restart comes back clamped to the front, not moved by its parent's clock, so the lag a short burst left is forgiven, and a child that was owed service loses what it was owed. Nor can it tell an idle sibling from a competing one, so a sibling may keep up to the front child's outstanding of lag it should forfeit (FairShareAllocator's Two histories). So the allocator exports its memory through FairShareAllocator.memory and takes it back through its constructor, and a caller that persists its ledger persists this beside it.
It is also how a caller asks a question without changing the answer: a throwaway allocator built over a copy of this value makes the same picks the real one would, and the real one has not moved.
It is scheduler-local, never replicated. Two peers may hold different memories, and that only reorders their grants: a wake offset can give a turn up, never create entitlement. Nothing here merges.
The maps are keyed by attachment id across the whole tree, the clocks by parent. They encode through CanonicalMapSerializer, so two equal memories encode to the same bytes whatever order the allocator's own hash maps happen to hold them in. The contents are deliberately not public: the only things a caller does with a memory are to keep it and to hand it back.
Each wake clamp is kept in ticks of its edge's own grid, wide (#3353): a waker idle for long beside a busy sibling is clamped the whole way up, and that can be past Long. It encodes as its two words, like a Gauge's ticks (WideTicksSerializer). A clamp of zero is absent, since an edge reads a missing one as zero, and a memory holding one is refused.
The clock is the virtual time a parent's asking children have kept, issued less refunded, per unit of their weight, in clock ticks, 720,720 to one tick of a weight-1 child (a step that does not divide evenly rounds up, by under a clock tick); served is where each child's baseIssued − returned stood when its parent's clock last ran; and departures is where the clock stood when this peer saw a child stop asking. A clock can run backward on a round whose refunds outweigh its grants, so it, and a departure read off it, are signed (SignedWideTicksSerializer). shiftRemainders is how far each child's shifts so far have run past its parent's clock, under one of its ticks (ShiftRemainder): a returner's next shift takes it off, so the rounding never adds up (#3416 review). Each of the four is elided when empty, so a memory that has run no clock encodes as before.
Its encoded shape is part of LocalHeddleSnapshot's format 1, which changed it in place for the wide clamps. A field added here takes a default, and any other change needs a frozen surrogate first.