Repository navigation
Fix background GC zeroing of arrays larger than 4 GiB - #135797
Merged
Merged
Conversation
Clear free-list metadata from every temporary free object before returning a background UOH allocation. Add large-memory regression coverage for 4, 6, and 8 GiB arrays. Co-authored-by: Copilot <[email protected]> Copilot-Session: 8776c79b-0b1a-4d72-b132-7531e8cb2b73
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @anicka-net, @dotnet/gc |
This was referenced Oct 15, 2026
Closed
kkokosa
approved these changes
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When a UOH allocation overlaps a background GC,
make_unused_arraytemporarily represents the allocation as free objects. Allocations larger than 4 GiB can require multiple pieces. On fresh memory, clearing their headers leaves thePREV_EMPTYfree-list marker in later pieces, violating the zero-initialization guarantee.Pass the object size to
UnsetFreeand clear the previous free-list pointer when the piece is large enough to contain it.clear_unused_arrayalready walks every temporary piece, so each piece's metadata is cleared before the allocation is returned.Add a process-isolated, long-running GC regression test that checks all elements of 4, 6, and 8 GiB arrays allocated during background GC. The test excludes WASM and 32-bit architectures, disables Mono builds, and requires at least 16 GiB of available GC memory.
Resolves #135791
Note
This PR description and the code changes were generated with GitHub Copilot.