4

We have a asp.net (.net 4.0) webapplication that is installed in several environments. In most environments, the memory usage is somewhere around 1GB. However, we have one environment where the memory usage peaks to 5.5GB. This is on a Server 2008 machine with 4 cores and 8GB of ram running as an VMWare esx client.

I've set up performance counters with the following results:

Memory
    Committed Bytes    10 145 739 948,0000
    Pages Output/sec                0,0000

Paging File                         _Total
    % Usage                         28,998

Process                             _Total                w3wp
    Working Set              7 480 003 280       5 604 421 056

I also took a memory dump of the w3wp process (when it was +/-2GB, because larger dumps failed). Running DebugDiag on the dump didn't make me any wiser. It seems like .net itself is only taking up 800MB and the bulk of the memory is taken up by 'something else'.

.NET GC Heap Information
GC Heap Size          826,09 MBytes  
Total Commit Size       1217 MB 
Total Reserved Size    16190 MB 

Heap Analysis
Summary
Number of heaps   29 Heaps 
Total reserved memory   1,89 GBytes 
Total committed memory   1,79 GBytes 

...
(largest of the Heaps)
Reserved memory                     1,69 GBytes 
Committed memory                    1,67 GBytes(99,14% of reserved) 
Uncommitted memory                  14,86 MBytes(0,86% of reserved) 
Number of heap segments             113 segments 
Number of uncommitted ranges        113 range(s) 
Size of largest uncommitted range   0 Bytes 

The thing is that I'm not sure that this high memory usage is a problem. So what I'm looking for is some guidance of how to proceed with this issue:

  • Either someone tells me this is just how IIS7 works and I shouldn't worry about the memory.
  • Or someone points me how I can analyse this dump further (especially how I can see what's in that 1,6GB heap.
  • Or explain to me why there is such a big difference between what .net is using and what W3WP is using.

EDIT: This is what I see in ProcExp: enter image description here

As you can see, the total Bytes in all heaps is 1.12GB. At the time, the W3WP was using 6.4GB. Why is there such a big difference between these two numbers? What could be taking up this space? Is this the fragmenting of the LOH that I see?

Lodewijk
  • 151
  • 7

2 Answers2

3

This is really more of a developer question, and is not related to IIS.

First thing you should do is identify which generation heap the memory is in (0, 1, 2, or 3 (Large Object Heap))

Process Explorer provides an easy way to display this information.

For the most part, the .NET GC is self-managing. There are a few .config parameters to adjust this, but this is really an area where the developer should provide guidance.

If you want to inspect the heap, WinDbg is probably the tool of choice.

http://blogs.microsoft.co.il/sasha/2010/08/24/psscor2-object-inspection-commands-part-2/

http://blogs.microsoft.co.il/sasha/2010/08/26/psscor2-gc-heap-analysis-commands/

Process Explorer GC Heap Information

Greg Askew
  • 35,880
  • 5
  • 54
  • 82
  • I've updated my question with the ProcExp info. I'm asking it in ServerFault because I cannot explain the difference between what .net is using and what W3WP is using. – Lodewijk Aug 17 '15 at 09:55
1

For those who end up here with something similar: in the end it was unmanaged code in the Active Directory libraries of the .net framework that was not disposed correctly. That's why the unmanaged heap was so large.

How did I find out what was the culprit? I just ended up looking at random memory addresses to find out what the contents was. And since I found a lot of Active Directory related data, I knew that was leaking data.

A few Dispose() calls later, the problem was solved.

Lodewijk
  • 151
  • 7