Monday, May 6, 2013

Is it leaking?

I wondered if my program was leaking. Here's how I found out:
Using Visual Studio 2012, into the immediate window, I typed:

.load SOS

Then, I investigated my class with this command (still in the immediate window).

!DumpHeap -type

I could see how many objects there were of this type in the heap. I could see their addresses in memory.

!gcroot

This command showed me where they came from and what other objects had references to them.

Finally:

!finalizequeue -allready

This allowed me to verify that although the object wasn't finalized yet, it was due to be whenever the Garbage Collector got around to it and therefore, my program wasn't leaking.