From: Paolo Molaro Date: Wed, 16 Feb 2005 21:23:39 +0000 (+0000) Subject: Wed Feb 16 22:30:54 CET 2005 Paolo Molaro X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a43aba752741302b091c32ea52669caa0bafa2b1;p=gc Wed Feb 16 22:30:54 CET 2005 Paolo Molaro * alloc.c: tune the code to collect instead of expanding the heap if there are many finalizers and we reclaimed some memory from cleaning the finalization queue (should fix bug #71001 and #70701). svn path=/trunk/mono/; revision=40776 --- diff --git a/ChangeLog b/ChangeLog index 89a05848..052fff6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ + +Wed Feb 16 22:30:54 CET 2005 Paolo Molaro + + * alloc.c: tune the code to collect instead of expanding + the heap if there are many finalizers and we reclaimed some + memory from cleaning the finalization queue (should fix + bug #71001 and #70701). + 2005-02-07 Geoff Norton * include/private/gc_priv.h: Bump the max root sets to 1024 diff --git a/alloc.c b/alloc.c index c1f40635..99a61f6f 100644 --- a/alloc.c +++ b/alloc.c @@ -1021,13 +1021,20 @@ unsigned GC_fail_count = 0; /* How many consecutive GC/expansion failures? */ /* Reset by GC_allochblk. */ +static word last_fo_entries = 0; +static word last_words_finalized = 0; + GC_bool GC_collect_or_expand(needed_blocks, ignore_off_page) word needed_blocks; GC_bool ignore_off_page; { if (!GC_incremental && !GC_dont_gc && - (GC_dont_expand && GC_words_allocd > 0 || GC_should_collect())) { + (GC_dont_expand && GC_words_allocd > 0 + || (GC_fo_entries > (last_fo_entries + 500) && (last_words_finalized || GC_words_finalized)) + || GC_should_collect())) { GC_gcollect_inner(); + last_fo_entries = GC_fo_entries; + last_words_finalized = GC_words_finalized; } else { word blocks_to_get = GC_heapsize/(HBLKSIZE*GC_free_space_divisor) + needed_blocks;