The case of the leaking thread handles
This was one of the more challenging and interesting problems to debug in a while. When testing out code for an unrelated fix, I noticed that the application’s handle count, as seen in the Handles column in Task Manager, kept rising steadily. WinDbg, showed that the app was leaking thread handles. 0:003> !handle1417 HandlesType CountEvent 452Section 8File 12Port 2Directory 3Thread 916Desktop 1KeyedEvent 1 Half expecting the code to hold references to dead threads, I dumped Thread objects in the GC heap. 0:003> !dumpheap -stat -type System.Threading.Threadtotal 353 objectsStatistics: MT Count TotalSize … Continue reading The case of the leaking thread handles