From 43fa22f07449f24f6959b959e49c69aff91a8a14 Mon Sep 17 00:00:00 2001 From: Peter Sollich Date: Fri, 30 Sep 2022 01:27:21 +0200 Subject: [PATCH] Disable gen 1 budget accounting fix for segments, so the segments implementation of GC behaves like .NET 6.0 did. (#76365) --- src/coreclr/gc/gc.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index e04b77284d8394..adccf6dd48323c 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -21467,7 +21467,14 @@ void gc_heap::gc1() dynamic_data* dd = hp->dynamic_data_of (gen); dd_desired_allocation (dd) = desired_per_heap; dd_gc_new_allocation (dd) = desired_per_heap; +#ifdef USE_REGIONS + // we may have had some incoming objects during this GC - + // adjust the consumed budget for these dd_new_allocation (dd) = desired_per_heap - already_consumed_per_heap; +#else //USE_REGIONS + // for segments, we want to keep the .NET 6.0 behavior where we did not adjust + dd_new_allocation (dd) = desired_per_heap; +#endif //USE_REGIONS if (gen == 0) { @@ -40506,9 +40513,14 @@ void gc_heap::compute_new_dynamic_data (int gen_number) } dd_gc_new_allocation (dd) = dd_desired_allocation (dd); +#ifdef USE_REGIONS // we may have had some incoming objects during this GC - // adjust the consumed budget for these dd_new_allocation (dd) = dd_gc_new_allocation (dd) - in; +#else //USE_REGIONS + // for segments, we want to keep the .NET 6.0 behavior where we did not adjust + dd_new_allocation (dd) = dd_gc_new_allocation (dd); +#endif //USE_REGIONS } gen_data->pinned_surv = dd_pinned_survived_size (dd);