Tracing collector laboratory · 384-byte heap

Garbage Collector Garden

Grow an object graph, trace it from pinned roots, sweep unreachable cycles, then compact the survivors and watch every stale pointer get rewritten.

Collector state Ready to trace Cycle / leak lab · seed 357
Collector strategy
Live bytes 0 B reachable from roots
Garbage bytes 0 B currently unreachable
Reclaimed bytes 0 B this collection
Fragmentation 0% external · 1 free run
Pause time 0.0 ms deterministic STW model
Heap used 0 B 384 B free

Living heap

Mutator
  1. Roots
  2. Mark
  3. Sweep
  4. Compact
Reachable Unreachable Mark frontier Relocated / stale pointer
Interactive heap object graph and memory map Pinned roots connect to reachable objects. Unreachable objects are striped red. The lower memory cells expose gaps and relocation.

Select a pod in the graph or object list. Pointer labels show the stored byte address; amber labels are stale until the compacting collector rewrites them.

Collector comparison

Mark–sweep

Trace from roots, free white objects, keep every survivor at the same address. Fast pointer handling; holes remain.

Projecting…

Copy / compact

Relocate survivors into a dense prefix and rewrite roots and fields. Allocation becomes a bump; addresses change.

Projecting…

This runnable relocation path is mark-compact: it marks, sweeps, then slides. A semispace copying collector traces directly into to-space instead; both relocate survivors and must rewrite pointers, but copying reserves extra space.

Invariant checks

    Collector journal