Your opinion matters! Please fill in the InfoQ Survey!

Ruby 2.1.0 Released, Delivering new GC

| by Jeff Martin Follow 6 Followers on Dec 30, 2013. Estimated reading time: 1 minute |

A note to our readers: As per your request we have developed a set of features that allow you to reduce the noise, while not losing sight of anything that is important. Get email and web notifications by choosing the topics you are interested in.

The official release of Ruby 2.1 has arrived, bringing with it a number of anticipated improvements, including big changes to the garbage collector which will bring several performance enhancements now and in the future. 

The garbage collector in Ruby 2.1 implements a form of generational garbage collection, with Ruby calling their implementation RGenGC (Restricted Generational Garbage Collection).  This replaces the “Mark & Sweep” implementation used in previous versions of Ruby.  A presentation by Ruby developer Koichi Sasada in April 2013 observed that the challenge for Ruby developers was to implement a GC algorithm that could handle both protected and unsafe objects in the same heap. 

Since rewriting all existing C-extensions to use the new GC is not practical, Write-Barriers are used as part of the RGenGC implementation.  As Sasada explains in a presentation (PDF) given at RubyConf 2013, RGenGC provides a third way given the 2 original alternatives:  A) Do not implement generational GC at all (as in Ruby 2.0 & before) or B) Implement Generational GC with a requirement that all C-extensions are rewritten. 

Using RGenGC provides high compatibility with existing extensions while still bringing performance improvements.  Popular objects Array, String, Hash, Object, and Numeric are Write-Barrier protected, thus able to take advantage of the RGenGC system.  Future work on both internal and external libraries offer the possibility of additional performance gains in the future.

The new garbage collection system is not the only improvement, others include RDoc 4.1.0, RubyGems 2.2.0, and several updated libraries.  For a complete list of 2.1’s changes take a look at the release notes located at the project’s GitHub page.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread


Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you