diff --git a/gc.c b/gc.c index ff7a03db..6cac830f 100644 --- a/gc.c +++ b/gc.c @@ -1361,7 +1361,8 @@ fprintf(stderr, "slow alloc of %p\n", result); #endif if (result) { // Check if we need to start a major collection - if (heap_type != HEAP_HUGE && gc_num_unswept_heaps(h_passed) < 2) { + if (heap_type != HEAP_HUGE && gc_num_unswept_heaps(h_passed) < + GC_COLLECT_UNDER_UNSWEPT_HEAP_COUNT) { gc_start_major_collection(thd); } } else { diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 8dadb639..fb92f640 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -113,6 +113,9 @@ typedef unsigned char tag_type; /** Start GC cycle if % heap space free below this percentage */ #define GC_COLLECTION_THRESHOLD 0.0125 //0.05 +/** Start GC cycle if fewer than this many heap pages are unswept */ +#define GC_COLLECT_UNDER_UNSWEPT_HEAP_COUNT 3 + /** After major GC, grow the heap so at least this percentage is free */ #define GC_FREE_THRESHOLD 0.40 // END GC tuning