Chapter 12. Garbage Collection in MRI, JRuby, and Rubinius

image with no caption

The garbage collector is where Ruby objects are born and where they die.

Garbage collection (GC) is the process high-level languages like Ruby use to manage memory for you. Where do your Ruby objects live while you’re using them? How does Ruby clean up objects your program no longer uses? Ruby’s GC system solves these problems.

Garbage collection is not unique to Ruby. The first implementation of garbage collection was in the Lisp programming language, invented by John McCarthy around 1960. Like Ruby, Lisp manages memory for you automatically using garbage collection. Since its invention, ...

Get Ruby Under a Microscope now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.