Skip to content

Commit

Permalink
This fixes an issue with gradual decommit in scenarios where we have … (
Browse files Browse the repository at this point in the history
#84975)

This fixes an issue with gradual decommit in scenarios where we have almost exclusively background GCs.

The problem is that we turn off the gradual_decommit_in_progress_p flag and rely on the distribute_free_regions flag to turn it back on. If we only trigger a BGC however, distribute_free_regions won't get called and the flag will stay off, despite the global_regions_to_decommit list being non-empty.

This will cause regions to accumulate in the global_regions_to_decommit list, and eventual will cause the process to run out of memory.

The fix is to just test for the no gc region case in decommit_step. This will also turn off the gradual_decommit_in_progress_p flag for the no gc region case, but not for background GCs.
  • Loading branch information
PeterSolMS committed May 22, 2023
1 parent 5c0215e commit dd390e1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6848,7 +6848,6 @@ void gc_heap::gc_thread_function ()
END_TIMING(suspend_ee_during_log);

proceed_with_gc_p = TRUE;
gradual_decommit_in_progress_p = FALSE;

if (!should_proceed_with_gc())
{
Expand Down Expand Up @@ -41526,6 +41525,12 @@ void gc_heap::decommit_ephemeral_segment_pages()
// return true if we actually decommitted anything
bool gc_heap::decommit_step (uint64_t step_milliseconds)
{
if (settings.pause_mode == pause_no_gc)
{
// don't decommit at all if we have entered a no gc region
return false;
}

size_t decommit_size = 0;

#ifdef USE_REGIONS
Expand Down

0 comments on commit dd390e1

Please sign in to comment.