From c3b5bc98d0e3e59de72b5387f7007a5d8b49b10d Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sun, 20 Mar 2022 15:22:21 -0700 Subject: [PATCH 1/2] Release CordbUnmanagedThread from CordbProcess member The m_lastDispatchedIBEvent was not be cleared during shutdown, which was causing a memory leak assert to fire. --- src/coreclr/debug/di/process.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index 0427cc0dd7d61..09239fc343221 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -1312,6 +1312,12 @@ void CordbProcess::NeuterChildren() m_steppers.NeuterAndClear(GetProcessLock()); #ifdef FEATURE_INTEROP_DEBUGGING + if(m_lastDispatchedIBEvent != NULL) + { + m_lastDispatchedIBEvent->m_owner->InternalRelease(); + m_lastDispatchedIBEvent = NULL; + } + m_unmanagedThreads.NeuterAndClear(GetProcessLock()); #endif // FEATURE_INTEROP_DEBUGGING From a274d4ac737023249355ca188de70fb299be01d3 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sun, 20 Mar 2022 19:35:59 -0700 Subject: [PATCH 2/2] Update src/coreclr/debug/di/process.cpp Co-authored-by: Adeel Mujahid <3840695+am11@users.noreply.github.com> --- src/coreclr/debug/di/process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/debug/di/process.cpp b/src/coreclr/debug/di/process.cpp index 09239fc343221..354e8dcde1191 100644 --- a/src/coreclr/debug/di/process.cpp +++ b/src/coreclr/debug/di/process.cpp @@ -1312,7 +1312,7 @@ void CordbProcess::NeuterChildren() m_steppers.NeuterAndClear(GetProcessLock()); #ifdef FEATURE_INTEROP_DEBUGGING - if(m_lastDispatchedIBEvent != NULL) + if (m_lastDispatchedIBEvent != NULL) { m_lastDispatchedIBEvent->m_owner->InternalRelease(); m_lastDispatchedIBEvent = NULL;