diff options
-rw-r--r-- | marshal.c | 8 | ||||
-rw-r--r-- | test/ruby/test_marshal.rb | 3 |
2 files changed, 7 insertions, 4 deletions
@@ -1053,8 +1053,8 @@ rb_marshal_dump_limited(VALUE obj, VALUE port, int limit) rb_io_write(arg->dest, arg->str); rb_str_resize(arg->str, 0); } - free_dump_arg(arg); - rb_gc_force_recycle(wrapper); + clear_dump_arg(arg); + RB_GC_GUARD(wrapper); return port; } @@ -2084,8 +2084,8 @@ rb_marshal_load_with_proc(VALUE port, VALUE proc) if (!NIL_P(proc)) arg->proc = proc; v = r_object(arg); - free_load_arg(arg); - rb_gc_force_recycle(wrapper); + clear_load_arg(arg); + RB_GC_GUARD(wrapper); return v; } diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index bc22b5fd3a..bfc3f6df25 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -644,6 +644,9 @@ class TestMarshal < Test::Unit::TestCase c = Bug9523.new assert_raise_with_message(RuntimeError, /Marshal\.dump reentered at marshal_dump/) do Marshal.dump(c) + GC.start + 1000.times {"x"*1000} + GC.start c.cc.call end end |