Hi,
I am loading C# dll in my unmanaged code through COM Interop. Recently I noticed that handle count in my application is increasing due to this managed code. When remove the code to load C# dll, handle count become stable. Windbg is showing multiple open handles for following call stacks:--------------------------------------Handle = 0x0000000000000ee0 - OPENThread ID = 0x0000000000000e90, Process ID = 0x00000000000011cc
0x000007ff06fc306a: ntdll!ZwCreateEvent+0x000000000000000a0x000007fef4146a1f: vfbasics!AVrfpNtCreateEvent+0x00000000000000a30x000007ff040a271f: KERNELBASE!CreateEventW+0x00000000000000630x000007fef4146c30: vfbasics!AVrfpCreateEventW+0x00000000000000c40x000007fef8ef0aa7: clr!CLREventBase::CreateManualEvent+0x00000000000000280x000007fef8ef18d1: clr!Thread::AllocHandles+0x00000000000000510x000007fef8ef2681: clr!Thread::CreateNewOSThread+0x00000000000000910x000007fef8ef25a6: clr!Thread::CreateNewThread+0x00000000000000ae0x000007fef8ef2e01: clr!ThreadpoolMgr::CreateUnimpersonatedThread+0x00000000000000c50x000007fef8dd44a8: clr!ThreadpoolMgr::CreateWorkerThread+0x00000000000000190x000007fef8dd4481: clr!ThreadpoolMgr::MaybeAddWorkingWorker+0x000000000000011d0x000007fef8dd4b6c: clr!ManagedPerAppDomainTPCount::SetAppDomainRequestsActive+0x00000000000000240x000007fef8dd4c2a: clr!ThreadpoolMgr::SetAppDomainRequestsActive+0x000000000000002a0x000007fef8dd4bba: clr!ThreadPoolNative::RequestWorkerThread+0x000000000000002f--------------------------------------Handle = 0x00000000000011b4 - OPENThread ID = 0x0000000000000f84, Process ID = 0x00000000000011cc
0x000007ff06fc36fb: ntdll!ZwCreateThreadEx+0x000000000000000a0x000007ff040c0d53: KERNELBASE!CreateRemoteThreadEx+0x00000000000002630x000007ff0414728b: KERNELBASE!CreateThread+0x000000000000003b0x000007fef4149234: vfbasics!AVrfpCreateThread+0x00000000000000b00x000007fef8ef26b5: clr!Thread::CreateNewOSThread+0x00000000000000c50x000007fef8ef25a6: clr!Thread::CreateNewThread+0x00000000000000ae0x000007fef8ef2e01: clr!ThreadpoolMgr::CreateUnimpersonatedThread+0x00000000000000c50x000007fef8dd44a8: clr!ThreadpoolMgr::CreateWorkerThread+0x00000000000000190x000007fef8dd4481: clr!ThreadpoolMgr::MaybeAddWorkingWorker+0x000000000000011d0x000007fef8dd4b6c: clr!ManagedPerAppDomainTPCount::SetAppDomainRequestsActive+0x00000000000000240x000007fef8dd4c2a: clr!ThreadpoolMgr::SetAppDomainRequestsActive+0x000000000000002a--------------------------------------Here are few lines of the code that I am using to load the c# dll:try { m_var = ABC::IABCServerPtr(__uuidof(ABC::ABCServer)); m_var->Initialize(); }where m_var is ABC::IABCServerPtr . And call m_var->Initialize() prepares a hosting environment like web server.I am very new to C# programming and by looking into this call stack I am not able to understand why CLR is allocating these handles. These handles are increasing with time. Can anyone please let me know why these handles are being created and how can we stop this handle leak ?Thanks in advance !!!