When New Relic made the move from Ruby 1.8 to 1.9, we found a significant improvement to garbage collection time, so we explored what was going on in MRI’s garbage collection internals. Starting with the fundamentals of object creation and garbage collection in MRI, we walk through the C internals from Foo.new through garbage collection. We’ll explore the idiom and optimizations in the C source and leave you feeling comfortable to work in the code yourself. Once we arrive at the end of the rabbit hole, we’ll examine the garbage collection algorithms used in Ruby 1.8, 1.9 and 2.0.