Reworking Memory Management in CRuby: A Practitioner Report
summary
Reports integrating MMTk into CRuby by refactoring a non‑modular GC into a pluggable interface, implementing four stages: no-GC, non‑moving, copying (IMMIX/sticky IMMIX) and generational collection. Key engineering fixes are identifying PPP (potential pinning parents) to pin before scavenging, handling WB-unprotected legacy APIs by conservatively treating them as updated, and eliminating widespread finalizers by moving string/array/regexp payloads from malloc into the GC heap. The result runs Rails, upstreams a modular API (CRuby 3.4) and exposes remaining bottlenecks in finalization and parallel malloc.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:05CRuby GC history
- 2:52Motivation for MMTK
- 3:35Challenges with MMTK
- 4:40No GC and allocation
- 5:02Non-copying GC and stopping
- 5:44Copying GC and forwarding
- 9:00Generational GC and barriers
- 10:45Performance bottlenecks
- 13:38Refactoring finalizers
- 15:02Lessons and future
- 16:06Q&A








