From c06f12031ee1f6a7f51448f0688a20d571aed880 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 5 Dec 2013 01:47:12 +0000 Subject: gc.c: flush all deferred finalizers * gc.c (finalize_deferred): flush all deferred finalizers while other finalizers can get ready to run newly by lazy sweep. [ruby-core:58833] [Bug #9205] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_gc.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 034a330c85..41e09b63fb 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -238,4 +238,18 @@ class TestGc < Test::Unit::TestCase assert_not_nil GC::INTERNAL_CONSTANTS[:HEAP_OBJ_LIMIT] assert_not_nil GC::INTERNAL_CONSTANTS[:RVALUE_SIZE] end + + def test_sweep_in_finalizer + bug9205 = '[ruby-core:58833] [Bug #9205]' + 100.times do + assert_ruby_status([], <<-'end;', bug9205) + raise_proc = proc do |id| + GC.start + end + 1000.times do + ObjectSpace.define_finalizer(Object.new, raise_proc) + end + end; + end + end end -- cgit v1.2.3