diff options
author | Paolo Molaro <lupus@oddwiz.org> | 2005-02-17 00:23:39 +0300 |
---|---|---|
committer | Paolo Molaro <lupus@oddwiz.org> | 2005-02-17 00:23:39 +0300 |
commit | 9e4431fee86a768353e4e8b7abbe4e2bde80d0d4 (patch) | |
tree | cdfd43a12b212e53b3567eed59542dab2d9896ca /libgc | |
parent | 852f078c276404181d0e56e722a0e9c5c3a814aa (diff) |
Wed Feb 16 22:30:54 CET 2005 Paolo Molaro <lupus@ximian.com>
* 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
Diffstat (limited to 'libgc')
-rw-r--r-- | libgc/ChangeLog | 8 | ||||
-rw-r--r-- | libgc/alloc.c | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libgc/ChangeLog b/libgc/ChangeLog index 0e8f4af9583..ed886bf09c4 100644 --- a/libgc/ChangeLog +++ b/libgc/ChangeLog @@ -1,3 +1,11 @@ + +Wed Feb 16 22:30:54 CET 2005 Paolo Molaro <lupus@ximian.com> + + * 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 <gnorton@customerdna.com> * include/private/gc_priv.h: Bump the max root sets to 1024 diff --git a/libgc/alloc.c b/libgc/alloc.c index c1f40635071..99a61f6f287 100644 --- a/libgc/alloc.c +++ b/libgc/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; |