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

* gc.c (free_method_entry_i): method entry may be in

unlinked_method_entry_list.  [ruby-core:43383][Bug #6171]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-03-18 08:17:39 +00:00
parent 7e78f6f526
commit 2555f3f5bf
3 changed files with 20 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sun Mar 18 17:17:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gc.c (free_method_entry_i): method entry may be in
unlinked_method_entry_list. [ruby-core:43383][Bug #6171]
Sun Mar 18 15:27:31 2012 Tanaka Akira <akr@fsij.org>
* compile.c: typo fix by Run Paint Run Run.

4
gc.c
View file

@ -1709,7 +1709,9 @@ mark_m_tbl(rb_objspace_t *objspace, st_table *tbl, int lev)
static int
free_method_entry_i(ID key, rb_method_entry_t *me, st_data_t data)
{
rb_free_method_entry(me);
if (!me->mark) {
rb_free_method_entry(me);
}
return ST_CONTINUE;
}

View file

@ -461,4 +461,16 @@ class TestMethod < Test::Unit::TestCase
assert_nothing_raised { v.instance_eval { mv2 } }
assert_nothing_raised { v.instance_eval { mv3 } }
end
def test_bound_method_entry
bug6171 = '[ruby-core:43383]'
assert_ruby_status([], <<-EOC, bug6171)
class Bug6171
def initialize(target)
define_singleton_method(:reverse, target.method(:reverse).to_proc)
end
end
1000.times {p = Bug6171.new('test'); 10000.times {p.reverse}}
EOC
end
end