Jon AtkinsonI'm a web developer and system administrator

Posts tagged with 'ruby'

Fixing RubyGems out of memory errors

Posted on 10th September 2008. Tagged as tips, ruby, debian

I run Debian Etch on a 256MB Xen instance (provided by Mampi). For quite a long time I've been running into out of memory errors when using RubyGems. The usual transcript would go something like this:

$ sudo gem install rails
Bulk updating Gem source index for: http://gems.rubyforge.org
Killed

For a while, I hacked around this problem by increasing my RAM to 512MB when I needed to run RubyGems (which is a terrible solution, but I have the ability to increase my RAM at will, and when all you have is a hammer, everything looks like a nail). I was using the packaged version of RubyGems (0.90), which it turns out is horribly out of date now. I can't find a definitive source, but various mailing lists are pointing to an issue with the YAML parser causing Gems to use far too much memory.

The upgrade to a more recent version of RubyGems is fairly simple:

wget http://rubyforge.org/frs/download.php/38646/rubygems-1.2.0.tgz
tar xzf rubygems-1.2.0.tgz
cd rubygems-1.2.0.tgz
sudo ruby setup.rb

If you haven't removed your old (packaged) version of RubyGems, you will need to do so now, then create a symlink to the new Gems executable:

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

If you run the new version of Gems, you'll notice much reduced RAM usage.

Twitter

About Me

Picture of Jon Atkinson

Jon Atkinson is a web developer, sysadmin and occasional business guy. He works in the north west of England.

Jon can be contacted at , or on freenode as JonA. Also available: twitter, LinkedIn and Github.

84labs logo

I own and run 84labs, a company which provides bespoke web application development for businesses and startups.

If you're interested in working with me, take a look, then contact me via 84labs.

Testled logo

I'm one of the founders of Testled.com, a web service to provide simple remote usability testing of web sites and desktop applications

Testled.com is currently in private beta, but you can still signup for an invite.