diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-03 07:56:09 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-03 07:56:09 +0000 |
commit | b46b1e3f5a7ec5d72b9597f387e0eee802d4ab63 (patch) | |
tree | f7b7d55fdc9bad0993092bbd84f403d7b4cdbde9 /test/ruby/test_object.rb | |
parent | 8322ca8a211c48ad1657a041c9f5529baa395762 (diff) | |
download | ruby-b46b1e3f5a7ec5d72b9597f387e0eee802d4ab63.tar.gz |
object.c: fix memory leak
* object.c (rb_obj_copy_ivar): allocate no memory for empty
instance variables. [ruby-core:64700] [Bug #10191]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_object.rb')
-rw-r--r-- | test/ruby/test_object.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_object.rb b/test/ruby/test_object.rb index 4573dc859e..e79913ead0 100644 --- a/test/ruby/test_object.rb +++ b/test/ruby/test_object.rb @@ -811,4 +811,14 @@ class TestObject < Test::Unit::TestCase assert_raise_with_message(TypeError, "can't convert Array into Integer") {Integer([42])} assert_raise_with_message(TypeError, 'no implicit conversion of Array into Integer') {[].first([42])} end + + def test_copied_ivar_memory_leak + bug10191 = '[ruby-core:64700] [Bug #10191]' + assert_no_memory_leak([], <<-"end;", <<-"end;", bug10191, rss: true) + def (a = Object.new).set; @v = nil; end + num = 500_000 + end; + num.times {a.clone.set} + end; + end end |