My random rumblings

Something of everything and nothing at all

Analysing Memory Leaks in .NET

To determine if an application has a memory leak add the .NET CLR Memory Windows performance counter. You need check for a trend over a long period of time rather than the immediate values.

Make a memory dump of the application.

Open WinDbg.

Click on File and then on Open Crash Dump.

Type the following commands:

lm

.load C:\windows\Microsoft.NET\Framework64\v4.0.30319\sos.dll

.sympath SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols

.symfix

.reload

!dumpheap -stat

 

From the above you should see which objects have excessive number of items, with the following you should get the addresses of the object:

!DumpHeap -type <TypeName>

Use the following to see what keeps this object in memory.

!GCRoot <Object_Address>


Loading