Project

General

Profile

Bug #11692 ยป example1.rb

Example with puts - gazay (Alex Gaziev), 11/15/2015 05:21 PM

 
1
class Foo
2
  def to_s
3
    puts self
4
  end
5
end
6

    
7
Thread.new do
8
  Foo.new.to_s
9
end
10

    
11
# Stack overflow exception occured and gc switched off
12

    
13
sleep 1
14

    
15
GC.start full_mark: true, immediate_sweep: true
16

    
17
if ObjectSpace.each_object(Thread).count > 1
18
  raise 'Should be only one thread after GC'
19
else
20
  puts 'All good'
21
end