summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--gc.c13
2 files changed, 10 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 27e9d3bc1a..41b7e1a9fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Nov 4 19:13:58 2010 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (after_gc_sweep, slot_sweep): finalizers should be invoked
+ as soon as possible.
+
Thu Nov 4 10:30:40 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
* configure.in (--with-valgrind): Now this option is default on.
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) {