Skip to content
Beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

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:

  1. Where do locals live?
  2. What is heap and who collects it?
  3. 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 live in function activation records unless captured by closures (Lambdas and closures).
  • Reassignment requires mut where the reference compiler enforces it (E1214 when you cheat).

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).

  • ref T and out parameters 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

Stack, heap, and spans