Upgrade to Pro — share decks privately, control downloads, hide ads and more …



A brief talk about Garbage Collection and the implications of the new RGenGC proposal.


Michael Bernstein

May 03, 2013


  1. Garbage? Garbage? GARRRRRBAAAAAAGG GGEEEEEEE mrb / lightning talks @ pp

    / May 3, 2013
  2. I Like Garbage

  3. I Like Thinking About Garbage

  4. I Like Thinking About Looking For Garbage

  5. None
  6. What is Garbage Collection?

  7. Automatic memory management for your computer programs.

  8. ( )

  9. None
  10. “Living” vs. “Dead”

  11. What memory are you using, and what memory can be

  12. Your objects form a graph.

  13. Traversing graphs is hard.

  14. The Big Algorithms • Mark and Sweep • Reference Counting

    • Generational
  15. Ruby makes a lot of garbage.

  16. Ruby’s Garbage Story https://bugs.ruby-lang.org/issues/8339 https://bugs.ruby-lang.org/attachments/3686/gc-strategy- en.pdf

  17. Ruby’s Current GC • Mark And Sweep • Conservative •

    Bitmap Marking • Non-Recursive Marking • No Moving • Favors C Extensions
  18. Rubyists wrote C extensions to make certain Ruby code run

  19. The primitive Garbage Collector supports these C extensions.

  20. Now, this same Garbage Collector is what is preventing Ruby

    code from being as fast as it could be.
  21. “Despite the best efforts of Koichi and other contributors, Ruby

    Core's concern with backwards compatibility (particularly regarding the C Extension API) keeps MRI lagging more than a decade behind Ruby implementations like Rubinius and JRuby which already have precise, generational and incremental garbage collectors.” - Vincent Marti (@vmg) https://github.com/blog/1489-hey-judy-don-t-make-it-bad
  22. RGenGC Is... • An awesome, fearless hack • Likely to

    make some Ruby code run faster • Certain to not break compatibility with C extensions • Progress
  23. RGenGC Isn’t... • The answer to Ruby’s problems • Likely

    to make all Ruby code faster in the long run • Going to draw people to Ruby • Limitless Progress
  24. In Conclusion • We need to figure this out •

    We can find a way forward
  25. Thanks!