Matt Valentine-House
Matt Valentine-House
  • @eightbitraptor

Matt is a Senior Developer at Shopify, working in the Ruby Infrastructure team. He's been working on improving CRuby since 2020 and is currently focused on memory management and garbage collection.

Heaping on the complexity! An adventure in GC Compaction

Recently some changes were made to the way Ruby stores objects of different sizes in memory. These changes impacted the way that the compaction handles fragmented memory inside the Ruby garbage collector.

In this talk I'll introduce the concepts of memory fragmentation and compacting GC's and discuss how Ruby implements compaction. I'll explore the consequences of the recent memory changes and take you on the journey I went on to explore some potential solutions, as well as the approach I eventually settled on.

Along the way we'll see some techniques to inspect Ruby's memory and introduce a tool I built, heapviz, that visualises the Ruby object space, allowing us to see the effect of compaction.

Presentation Material

Recorded video