gc-viz

Tri-color mark-sweep on a tiny heap. Two roots point into a live object graph; a two-node island (ef) and a lone g sit unreachable and will be swept.

The visible invariants:

  1. During mark, once a node goes black it never becomes white or grey again.
  2. When the grey set is empty, every node reachable from roots is black and every unreachable node stayed white.
  3. Sweep removes exactly the white set.

The pure model lives in wal-sh.tools.gc-viz.core (host-neutral .cljc); the SVG rendering is wal-sh.tools.gc-viz.browser. Adapted from Peter Zhu's RubyConf 2026 talk Building the Next-Generation Garbage Collector in Ruby – Ruby is moving to MMTk (memory management toolkit); tri-color mark is the primitive underneath. Build: gmake tools-cljs; debug: gmake dev-tool TOOL=gc-viz.