From cac1b598b666b126069d9ca651b6429673e13f57 Mon Sep 17 00:00:00 2001 From: Peter Sollich Date: Fri, 28 Oct 2022 10:11:48 +0200 Subject: [PATCH] Fix issue with spurious unproductive full GC which led to OOM. (#77478) Problem was that a BGC was in progress when the full GC was requested by setting the last_gc_before_oom flag, and at the end of the BGC we turned off the last_gc_before_oom flag. Fix is simply not to turn off the flag in the case of BGC. --- src/coreclr/gc/gc.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 6564fb239d279c..0acfa4cd10b218 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -21764,7 +21764,10 @@ void gc_heap::gc1() #endif //BACKGROUND_GC #endif //MULTIPLE_HEAPS #ifdef USE_REGIONS - last_gc_before_oom = FALSE; + if (!(settings.concurrent)) + { + last_gc_before_oom = FALSE; + } #endif //USE_REGIONS }