Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #77480 to release/7.0-staging.
Customer Impact
We have seen internal customers encounter out-of-memory exceptions due to this issue. The bug leads to spurious Full compacting GCs for their scenario. Instead of acquiring a new segment by reserving more memory, gc_heap::allocate_uoh will actually try to fit the requested size in a free region in the region map or allocate a new one at the end of the region map. This ultimately leads to OOMs when the process is close to exhausting bookkeeping hard commit limit, the LOH size increase will never happen. The fix is to remove the hard_limit_for_bookkeeping and associated fields, and instead commits memory for the mark array eagerly
Testing
This has been in .NET Core 8.0 since 12/12/22 without adverse effects noticed. At the time, extensive testing with low hard limits was done.
Risk
Low - the fix mostly removes problematic code, the amount of new code added is minimal.