A presentation at AmsterdamRB - Talks & Drinks in in Amsterdam, Netherlands by Sanne Kalkman
Even clean code creates garbage. Although most of us don't take out our own trash, we should still know how it's done!
In our daily development lives, most of us don’t have to worry about unused objects gathering cobwebs and filling up the memory. All we need to know is that our language has a garbage collector that just comes by and makes our trash disappear. Somehow it figures out what should stay and what can go, our program can keep going without running out of space, and we don’t have to do a thing.
It is not in fact magic that takes care of the garbage, and this talk will show you how it’s done. First, we’ll explore how two of the most common garbage collection algorithms, reference counting and tracing, figure out what is ready to be collected. Next, we’ll see how we could get the garbage truck out of the way faster by using a generational algorithm, and finally we’ll have a brief look at how Ruby’s garbage collection works.
This friendly introduction to taking out the trash gives an overview of important aspects of garbage collection algorithms. It is specifically meant to be accessible developers of all levels and you’ll walk away with an understanding of and appreciation for all the hard work that goes on behind the scenes.
The following resources were mentioned during the presentation or are useful additional information.
Very extensive book on garbage collection, for if you want to know more!
Excellent book on Ruby internals, with a full chapter on garbage collection.
Here’s what was said about this presentation on social media.