Skip to content

Commit 15b4005

Browse files
Disable gen 1 budget accounting fix for segments, so the segments implementation of GC behaves like .NET 6.0 did. (#76412)
Co-authored-by: Peter Sollich <[email protected]>
1 parent 0a09c8f commit 15b4005

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/coreclr/gc/gc.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21387,7 +21387,14 @@ void gc_heap::gc1()
2138721387
dynamic_data* dd = hp->dynamic_data_of (gen);
2138821388
dd_desired_allocation (dd) = desired_per_heap;
2138921389
dd_gc_new_allocation (dd) = desired_per_heap;
21390+
#ifdef USE_REGIONS
21391+
// we may have had some incoming objects during this GC -
21392+
// adjust the consumed budget for these
2139021393
dd_new_allocation (dd) = desired_per_heap - already_consumed_per_heap;
21394+
#else //USE_REGIONS
21395+
// for segments, we want to keep the .NET 6.0 behavior where we did not adjust
21396+
dd_new_allocation (dd) = desired_per_heap;
21397+
#endif //USE_REGIONS
2139121398

2139221399
if (gen == 0)
2139321400
{
@@ -40425,9 +40432,14 @@ void gc_heap::compute_new_dynamic_data (int gen_number)
4042540432
}
4042640433
dd_gc_new_allocation (dd) = dd_desired_allocation (dd);
4042740434

40435+
#ifdef USE_REGIONS
4042840436
// we may have had some incoming objects during this GC -
4042940437
// adjust the consumed budget for these
4043040438
dd_new_allocation (dd) = dd_gc_new_allocation (dd) - in;
40439+
#else //USE_REGIONS
40440+
// for segments, we want to keep the .NET 6.0 behavior where we did not adjust
40441+
dd_new_allocation (dd) = dd_gc_new_allocation (dd);
40442+
#endif //USE_REGIONS
4043140443
}
4043240444

4043340445
gen_data->pinned_surv = dd_pinned_survived_size (dd);

0 commit comments

Comments
 (0)