Skip to content

Fix memory leak in ICorDebugEnum::Clone on CordbEnumerator#124580

Open
noahfalk wants to merge 1 commit intodotnet:mainfrom
noahfalk:fix_cordebug_clone
Open

Fix memory leak in ICorDebugEnum::Clone on CordbEnumerator#124580
noahfalk wants to merge 1 commit intodotnet:mainfrom
noahfalk:fix_cordebug_clone

Conversation

@noahfalk
Copy link
Member

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

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>
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak when using ICorDebugEnum::Clone

2 participants

Comments