From dc89fbbc563f6656a2fcd7d5d3dfc909ce90908d Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 27 Jul 2018 12:19:46 -0400 Subject: [PATCH] Added GC_COLLECT_UNDER_UNSWEPT_HEAP_COUNT Also increased threshold from 2 to 3, to be a bit more aggresive with starting major GC's --- gc.c | 3 ++- include/cyclone/types.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) 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