Fix HandleTableBucket::Contains to account for slots in DATAS#125569
Open
hoyosjs wants to merge 3 commits intodotnet:mainfrom
Open
Fix HandleTableBucket::Contains to account for slots in DATAS#125569hoyosjs wants to merge 3 commits intodotnet:mainfrom
hoyosjs wants to merge 3 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/gc |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes handle table bucket membership checks in CoreCLR GC by ensuring HandleTableBucket::Contains iterates over the actual number of handle-table slots allocated per bucket (which can differ from IGCHeap::GetNumberOfHeaps() in some configurations, e.g., with DATAs / explicit heap counts).
Changes:
- Update
HandleTableBucket::Containsto iterate usinggetNumberOfSlots()rather thang_theGCHeap->GetNumberOfHeaps(). - Store the slot count in a local
n_slotsto match surrounding patterns and avoid repeated queries.
You can also share your feedback on Copilot code review. Take the survey.
This was referenced Mar 15, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This fixes iteration of the handle table for a given bucket. This bug had hit the DAC iteration as well as this code path. Each bucket has a handle table that has as many slots as cores for server GC. This was 1:1 prior to DATAs by default - it also hd a bug when an explicit number of heaps was set. The only reason this hadn't had any issues prior to this is this function is unused.
The other option is to use the first commit in this PR - rev the major of the GC interface and delete the function altogether.