Fix memory leak in ICorDebugEnum::Clone on CordbEnumerator#124580
Open
noahfalk wants to merge 1 commit intodotnet:mainfrom
Open
Fix memory leak in ICorDebugEnum::Clone on CordbEnumerator#124580noahfalk wants to merge 1 commit intodotnet:mainfrom
noahfalk wants to merge 1 commit intodotnet:mainfrom
Conversation
Add cloned enumerator to the process continue neuter list so it gets properly neutered during cleanup. Without this, cloned enumerators leak their internal m_items array and trigger a debug assertion failure (_ASSERTE(IsNeutered())) in the destructor. Fixes dotnet#121925 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a memory leak in the CoreCLR debugger's ICorDebugEnum::Clone implementation for CordbEnumerator. When an enumerator is cloned, the clone allocates its own internal array to store enumerated items, but without being added to the process's continue neuter list, this array never gets freed.
Changes:
- Added cloned enumerator to the continue neuter list to ensure proper cleanup during process shutdown
steveisok
approved these changes
Feb 19, 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.
Add cloned enumerator to the process continue neuter list so it gets properly neutered during cleanup. Without this, cloned enumerators leak their internal m_items array and trigger a debug assertion failure (_ASSERTE(IsNeutered())) in the destructor.
Fixes #121925