1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

gc.c (define_final0): avoid duplicate blocks

This prevents excessive memory growth when a WeakRef
is repeatedly created

* gc.c (define_final0): avoid duplicate blocks
  [Bug #10537]
* test/test_weakref.rb (test_repeated_object_leak): new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2014-12-13 01:28:18 +00:00
parent 58d992ec44
commit 856903850b
3 changed files with 28 additions and 0 deletions

View file

@ -60,4 +60,12 @@ class TestWeakRef < Test::Unit::TestCase
end
}, bug7304
end
def test_repeated_object_leak
bug10537 = '[ruby-core:66428]'
assert_no_memory_leak(%w(-rweakref), '', <<-'end;', bug10537)
a = Object.new
150_000.times { WeakRef.new(a) }
end;
end
end