Event handle leaks in a .NET Framework 4 based application
This article helps you resolve event handle leaks in a .NET Framework 4 based application.
Original product version: Microsoft .NET Framework 4
Original KB number: 2973904
This issue may occur even when the application is idle. Additionally, if you examine the process of this application by using a debugging tool, the stack resembles the following in which the event handles are allocated:
The issue occurs because the .NET Framework won't immediately reclaim the memory that is associated with these handles. The handles are reclaimed only when a Garbage Collection runs. For some applications, Garbage Collection happens rarely, because the application rarely allocates managed objects.
To resolve this issue, upgrade from the .NET Framework 4 to the latest version of the .NET Framework 4.5.
To work around this issue in the .NET Framework 4, call the
GC.Collect() method when the application needs to reclaim the handles immediately.