Keynote: Mark/Compact GC in MRI
summary
Implements a mark‑and‑compact GC for MRI using a simple two-finger compaction algorithm and exposes it via GC.compact; runs stop‑the‑world compaction (roughly 100 ms on the demo heap) and is already tested in production at GitHub. Major hurdles: C extensions that call RB_GC_mark, Ruby hashes that use object addresses as keys (making many entries unmovable), and C‑level global caches causing crashes. Measured effects with malloc stack logging and saw only about a 2% memory reduction, so work continues.
AI-written summary · about
chapters (23)
- 0:00Intro
- 1:12@tenderlove
- 6:41L-TRAC Mouse
- 16:36Compactor needs 2 things
- 18:06Memory Layout
- 19:41Page Layout
- 22:45Tree of Objects
- 23:25Mark Phase
- 24:10Mark Code
- 24:45Free Space
- 27:10Compaction Steps
- 30:43Update References Pt 2
- 31:06Visiting Each Slot 3 Times
- 32:353 Problem Cases
- 32:48Regular References
- 33:42Mark Functions
- 35:20Hash Table
- 36:10Default Hash Function
- 40:46Before Compaction
- 48:35Stack Log
- 48:47Processing Code
- 49:19System Managed vs GC Managed
- 49:41OS X (100k slots)








