From ad2dd24fb8da16c60613389e7a9ac0b1a1c6cd3c Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sat, 28 Nov 2015 05:38:56 -0700 Subject: [PATCH] incremental GC: split "incremental" finalization to single step Don't finalize after performing some marking work, since finalization is in one chunk, so it's best to avoid combining that delay with others. --- racket/src/racket/gc2/newgc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/racket/src/racket/gc2/newgc.c b/racket/src/racket/gc2/newgc.c index dcf4b4f987..d942249267 100644 --- a/racket/src/racket/gc2/newgc.c +++ b/racket/src/racket/gc2/newgc.c @@ -5918,11 +5918,12 @@ static void garbage_collect(NewGC *gc, int force_full, int no_full, int switchin if (do_incremental) { if (!gc->finishing_incremental) { - int fuel = INCREMENTAL_COLLECT_FUEL_PER_100M * ((gc->memory_in_use / (1024 * 1024 * 100)) + 1); mark_finalizer_structs(gc, 1); - propagate_incremental_marks(gc, 1, fuel); - if (mark_stack_is_empty(gc->inc_mark_stack)) { - /* If we run out of incremental marking work, + if (!mark_stack_is_empty(gc->inc_mark_stack)) { + int fuel = INCREMENTAL_COLLECT_FUEL_PER_100M * ((gc->memory_in_use / (1024 * 1024 * 100)) + 1); + propagate_incremental_marks(gc, 1, fuel); + } else { + /* We ran out of incremental marking work, so perform major-GC finalization in one go. */ mark_and_finalize_all_incremental(gc TIME_ARGS); BTC_clean_up_gen1(gc);