GC: guard against excessive fragmentation in incremental mode

Although excessive fragmentation is already detected at the end
of a major GC, it can get out of hand already during a long
incremental phase. So, check for excessive fragmentation and
bail out to a major GC when it happens.

Related to PR 15287
This commit is contained in:
Matthew Flatt 2016-04-19 10:29:07 -06:00
parent fa4a6d4c13
commit 9ff64fc6ed

View File

@ -5349,7 +5349,13 @@ static void garbage_collect(NewGC *gc, int force_full, int no_full,
&& !gc->started_incremental)
/* In incremental mode, GC earlier if we've done everything
that we can do incrementally. */
|| gc->accounted_incremental);
|| gc->accounted_incremental
/* Give up on incremental mode if fragmentation is
getting out of hand: */
|| (gc->started_incremental
&& (gc->memory_in_use > GEN0_MAX_SIZE)
&& (mmu_memory_allocated_and_used(gc->mmu)
> (HIGH_FRAGMENTATION_RATIO * gc->memory_in_use))));
if (gc->gc_full && no_full)
return;