Project

General

Profile

Misc #3757 ยป gcbug.rb

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

 
1
# First, require a bunch of stdlib extensions.
2
require 'readline'
3
require 'socket'
4
require 'curses'
5
require 'pty'
6
require 'openssl'
7
require 'bigdecimal'
8
require 'sdbm'
9
require 'fcntl'
10
require 'dl'
11
require 'syslog'
12
require 'tk'
13
require 'zlib'
14

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

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

    
24
# Bug appears in the loop below. Note no calls into gems or stdlib.
25
10.times do
26
  a = []
27
end