10.1 Memory model overview
How Beskid splits stack locals, GC heap objects, references, and cross-fiber sharing.
Memory model overview
Beskid memory law answers three questions without hand-waving:
- Where do locals live?
- What is heap and who collects it?
- What may fibers share without data races cosplaying as features?
Normative article: Memory and references. Collector algorithms defer to Memory and GC runtime contract (the /execution/ tree is a legacy bridge—platform-spec is authoritative).
Locals and mutability
Section titled “Locals and mutability”- Locals live in function activation records unless captured by closures (Lambdas and closures).
- Reassignment requires
mutwhere the reference compiler enforces it (E1214 when you cheat).
Heap and GC
Section titled “Heap and GC”Reference types and arrays live on the GC-managed heap. The runtime uses a concurrent collector story (tri-color heap work lives under abfall in the workspace—see execution ADRs like ABFALL tri-color heap).
References
Section titled “References”ref Tandoutparameters alias storage with compile-time rules.- Cross-fiber sharing of mutable state goes through channels, not shared stacks (Fibers and spawn).
flowchart TB stack[Stack activations — locals, spans] heap[GC heap — objects, arrays] fibers[Fibers — cooperative scheduling] channels[Channels — cross-fiber payloads] stack --> heap fibers --> channels heap --> fibers