views:

60

answers:

3

We got a problem in one of our ASP.net apps, the mscorwks.dll is using a lot of memory. Anyone got any tips on where to start looking for the memory leak ?

mscorwks!EEVirtualAlloc+119: 1.26 GBytes worth of outstanding allocations.

A: 

Use a .NET profiler such as

Mitch Wheat
A: 

Take a look at Investigating Memory Issues.

XIII
A: 

The steps to investigate which managed types are causing the leak, can be summarized in the following steps:

  1. Launch WinDbg and attach your process
  2. Load SOS debugger extension into WinDbg using: .loadby sos mscorwks (replace mscorwks with clr when your application runs on v4.0)
  3. Dump memory usage statistics using !dumpheap -stat
  4. Look for the leaking types (according to their memory usage and instance count)
  5. After finding the leaking type, dump its instances using !dumpheap -mt <INSTANCE METHODTABLE> (the methodTable can be retrieved from the output of the previous command)
  6. Pick some random instances and look why they are not released by GC collections (which gc roots still keep a reference to them) using !gcroot <INSTANCE ADDRESS>

At this point, you should have enough data to find the source of your leak.

A more detailed article about these steps can be found here.

Liran