Apparently it is sufficient to upgrade packages libruby1.8, ruby1.8 and ruby1.8-dev to encounter the bug.
It is possible that bug is actually caused only when you use libxml-ruby1.8. Maybe it is worth mentioning that original script used libxml, but didn't fail while using libxml (line in script). Here is script that reproduces the bug: #!/usr/bin/env ruby require 'xml/libxml' i = 0; while true doc = XML::Document.new; doc.root = XML::Node.new('gc-bug'); i += 1; puts "***************** #{i} *********" if i%100 == 0; end And output on my computer: $ ./gcbug.rb ***************** 100 ********* ***************** 200 ********* ***************** 300 ********* ***************** 400 ********* ***************** 500 ********* ***************** 600 ********* ***************** 700 ********* ***************** 800 ********* ***************** 900 ********* ***************** 1000 ********* ***************** 1100 ********* ***************** 1200 ********* ./gcbug.rb:8: [BUG] object allocation during garbage collection phase ruby 1.8.7 (2008-05-31 patchlevel 0) [x86_64-linux] Aborted
gcbug.rb
Description: application/ruby