Skip to content

Commit

Permalink
do more frequent BGCs and make them run longer
Browse files Browse the repository at this point in the history
  • Loading branch information
Maoni0 committed Jun 9, 2023
1 parent 591bf7c commit 4268929
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23670,6 +23670,16 @@ void gc_heap::garbage_collect (int n)
STRESS_HEAP_ARG(n)
);

if (settings.condemned_generation != max_generation)
{
// do more BGCs
if (((VolatileLoadWithoutBarrier (&settings.gc_index) % 5) == 0) && (!gc_heap::background_running_p ()))
{
settings.condemned_generation = max_generation;
should_do_blocking_collection = FALSE;
}
}

STRESS_LOG1(LF_GCROOTS|LF_GC|LF_GCALLOC, LL_INFO10,
"condemned generation num: %d\n", settings.condemned_generation);

Expand Down Expand Up @@ -36784,6 +36794,12 @@ void gc_heap::recover_bgc_settings()

void gc_heap::allow_fgc()
{
// lengthen the BGC CM phase
if (cm_in_progress)
{
GCToOSInterface::YieldThread (0);
}

assert (bgc_thread == GCToEEInterface::GetThread());
bool bToggleGC = false;

Expand Down

0 comments on commit 4268929

Please sign in to comment.