Understanding Garbage Collection in Ruby
summary
Covers Ruby GC internals (mark/sweep, tricolor marking, compaction, generational GC) and shows how to gather and interpret metrics with GC.stat to find GC-related latency. Explains variable width allocation and highlights using Shopify autotuner middleware to recommend settings. Presents a real Rails monolith upgrade from Ruby 3.1 to 3.3 that causes a 70–80% regression in worst‑case latency and how techniques like process warmup, out-of-band GC and custom background‑job preprocessing restore performance.
AI-written summary · about
chapters (12)
- 0:00Introduction and welcome
- 3:55Memory management in Ruby
- 6:09Garbage collection as memory manager
- 9:03Mark and sweep process
- 10:31Tricolor marking algorithm
- 12:24Garbage collection performance impact
- 13:56Generational garbage collection
- 15:49Debugging garbage collection issues
- 16:34Shopify's garbage collection autotuner
- 17:59Case study from Coupa
- 19:48Out of bound garbage collection
- 20:08Closing and acknowledgments
related talks
33mRails and the Ruby Garbage Collector: How to Speed Up Your Rails App
42mTweaking Ruby GC Parameters for Fun, Speed, and Profit
34mUnder the Hood of Ruby's Generational Garbage Collector
49mRabbit Hole: Garbage Collection and Ruby's Future
35mThe Hitchhiker's Guide to Ruby GC
38mWhy I am excited about Ruby 2.1?
30mBuilding the Next-Generation Garbage Collector in Ruby
37mDown the rb_newobj() Rabbit Hole: Garbage Collection in Ruby
