From 08db452620d5e39cf239b5fc82b7fed0a33cce37 Mon Sep 17 00:00:00 2001 From: ko1 Date: Thu, 4 Nov 2010 11:15:36 +0000 Subject: * 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 --- gc.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'gc.c') diff --git a/gc.c b/gc.c index a0f8527c88..8912e1cb57 100644 --- a/gc.c +++ b/gc.c @@ -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) { -- cgit v1.2.3