BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Ruby 2.1.0 Released, Delivering new GC

by Jeff Martin on Dec 30, 2013 |

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.

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

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT