mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
a object which is reachable from a part after this function, e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452] * test/ruby/test_gc.rb (test_finalizing_main_thread): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c86379402c
commit
59770bf960
3 changed files with 19 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,12 @@
|
|||
Fri Nov 30 07:46:42 2012 Narihiro Nakamura <authornari@gmail.com>
|
||||
|
||||
* gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
|
||||
a object which is reachable from a part after this function,
|
||||
e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
|
||||
|
||||
* test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
|
||||
for above.
|
||||
|
||||
Fri Nov 30 07:43:44 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread.c (rb_thread_interrupted): avoid warning of
|
||||
|
@ -462,7 +471,7 @@ Wed Nov 28 16:41:04 2012 Eric Hodel <drbrain@segment7.net>
|
|||
* lib/rdoc/servlet.rb: Add support for serving documentation from a
|
||||
subdirectory.
|
||||
* lib/rdoc/generator/darkfish.rb: ditto
|
||||
* test/rdoc/test_rdoc_servlet.rb: Test for above
|
||||
* test/rdoc/test_rdoc_servlet.rb: Tets for above
|
||||
* test/rdoc/test_rdoc_servlet.rb: ditto
|
||||
|
||||
Wed Nov 28 15:37:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
|
10
gc.c
10
gc.c
|
@ -1504,15 +1504,9 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
|
|||
if (ATOMIC_EXCHANGE(finalizing, 1)) return;
|
||||
|
||||
/* run finalizers */
|
||||
do {
|
||||
finalize_deferred(objspace);
|
||||
/* mark reachable objects from finalizers */
|
||||
/* They might be not referred from any place here */
|
||||
mark_tbl(objspace, finalizer_table);
|
||||
gc_mark_stacked_objects(objspace);
|
||||
st_foreach(finalizer_table, chain_finalized_object,
|
||||
(st_data_t)&deferred_final_list);
|
||||
} while (deferred_final_list);
|
||||
assert(deferred_final_list == 0);
|
||||
|
||||
/* force to run finalizer */
|
||||
while (finalizer_table->num_entries) {
|
||||
struct force_finalize_list *list = 0;
|
||||
|
|
|
@ -134,4 +134,10 @@ class TestGc < Test::Unit::TestCase
|
|||
ensure
|
||||
GC::Profiler.disable
|
||||
end
|
||||
|
||||
def test_finalizing_main_thread
|
||||
assert_in_out_err(%w[--disable-gems], <<-EOS, ["\"finalize\""], [], "[ruby-dev:46647]")
|
||||
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
|
||||
EOS
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue