How do I track down where I've been leaking IDisposable objects from?
<p>I've been debugging some code recently that was a bit memory leaky. It's a long running program that runs as a Windows service.</p>

<p>If you find a class wearing an <code>IDisposable</code> interface, it is telling you that some of the resources it uses are outside the abilities of the garbage collector to clean up for you. </p>

<p>The reason it is telling you this is that you, the user of this object, are now responsible for when these resources are cleaned up. Congratulations!</p>

<p>As a conscientious developer, you are nudged towards calling the <code>.Dispose()</code> method when you've finished with the object in order to release those unmanaged resources.</p>

<p>There is the nice <code>using()</code> pattern to help clean up these resources once they are finished with. Which just leaves finding which exact objects are causing the leakyness?</p>

<p>In order to aid tracking down these rogue unmanaged resources, is there any way to query what objects are loitering around waiting to be Disposed at any given point in time?</p>
