Keynote: Mark/Compact GC in MRI
summary
Implements a mark-and-compact GC for MRI that actually moves objects using two-finger compaction, then walks and rewrites all object references; allocation stops the world and compaction is triggered via GC.compact. On a Rails heap compaction groups movable objects so free pages drop from ~552 total (528 with free space) to about 160 pages with allocatable space, but real-world memory use only improves ~2%. Measurements use malloc stack logging; main obstacles are C extensions, hash keys hashed by object address, and C global caches.
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)








