Project

General

Profile

Misc #3757 ยป gcbug.rb

vjoel (Joel VanderWerf), 08/29/2010 05:54 AM

 
# First, require a bunch of stdlib extensions.
require 'readline'
require 'socket'
require 'curses'
require 'pty'
require 'openssl'
require 'bigdecimal'
require 'sdbm'
require 'fcntl'
require 'dl'
require 'syslog'
require 'tk'
require 'zlib'

# Second, require a gem. There's nothing too special about json. I've found
# others that work (even without having native code). If you load the library
# without using gems (use RUBYLIB instead), then the bug does not happen.
require 'json'

# This is not essential, but it makes the bug appear sooner and more
# reliably, using just the short loop below.
GC.stress = true

# Bug appears in the loop below. Note no calls into gems or stdlib.
10.times do
a = []
end
    (1-1/1)