Skip to content

Commit 4268929

Browse files
author
Maoni0
committed
do more frequent BGCs and make them run longer
1 parent 591bf7c commit 4268929

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23670,6 +23670,16 @@ void gc_heap::garbage_collect (int n)
2367023670
STRESS_HEAP_ARG(n)
2367123671
);
2367223672

23673+
if (settings.condemned_generation != max_generation)
23674+
{
23675+
// do more BGCs
23676+
if (((VolatileLoadWithoutBarrier (&settings.gc_index) % 5) == 0) && (!gc_heap::background_running_p ()))
23677+
{
23678+
settings.condemned_generation = max_generation;
23679+
should_do_blocking_collection = FALSE;
23680+
}
23681+
}
23682+
2367323683
STRESS_LOG1(LF_GCROOTS|LF_GC|LF_GCALLOC, LL_INFO10,
2367423684
"condemned generation num: %d\n", settings.condemned_generation);
2367523685

@@ -36784,6 +36794,12 @@ void gc_heap::recover_bgc_settings()
3678436794

3678536795
void gc_heap::allow_fgc()
3678636796
{
36797+
// lengthen the BGC CM phase
36798+
if (cm_in_progress)
36799+
{
36800+
GCToOSInterface::YieldThread (0);
36801+
}
36802+
3678736803
assert (bgc_thread == GCToEEInterface::GetThread());
3678836804
bool bToggleGC = false;
3678936805

0 commit comments

Comments
 (0)