diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-04 11:15:36 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-04 11:15:36 +0000 |
commit | 08db452620d5e39cf239b5fc82b7fed0a33cce37 (patch) | |
tree | 35401e6fc4554a6c1f3de79e4fb890077be89d11 /gc.c | |
parent | eb691b7cf177e5dfbd0f626146ab7e281f23bf88 (diff) |
* gc.c (after_gc_sweep, slot_sweep): finalizers should be invoked
as soon as possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -1006,7 +1006,6 @@ init_heap(rb_objspace_t *objspace) finalizer_table = st_init_numtable(); } - static void set_heaps_increment(rb_objspace_t *objspace) { @@ -1947,6 +1946,10 @@ slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot) objspace->heap.free_num += free_num; } objspace->heap.final_num += final_num; + + if (deferred_final_list) { + RUBY_VM_SET_FINALIZER_INTERRUPT(GET_THREAD()); + } } static int @@ -1995,13 +1998,7 @@ after_gc_sweep(rb_objspace_t *objspace) } malloc_increase = 0; - if (deferred_final_list) { - /* clear finalization list */ - RUBY_VM_SET_FINALIZER_INTERRUPT(GET_THREAD()); - } - else{ - free_unused_heaps(objspace); - } + free_unused_heaps(objspace); /* sweep unlinked method entries */ if (th->vm->unlinked_method_entry_list) { |