Windows – Find memory leak in ASP.NET Web App

asp.netiis-7memory-leakswindows

I'm hosting 7 websites on a single production server (virtual) at 2.53 Ghz (2 CPU) and 8GB of RAM on WIN SERVER 2008 R2 Enterprise 64 Bit.

Web server is IIS 7 and all of the websites are with .NET Framework 4.0 application pool.

My current memory usage is about 4.16 GB out of 8GB and w3wp.exe is the most process which consuming most of the memory usage (about 1.6 GB at this time) followed by sqlservr.exe with (1.5 GB) usage.

What I would like to do is to know which website out of 7 is consuming the most memory so that I could have a look.

I've tried Process Explorer and Resource monitor but it could only show how much rem taken by w3wp.exe but not individual website's usage.

Is there a way where I could pin point the memory hogger?

Best Answer

You could do a memory dump using Microsoft's Debug Diag tool.

Basic process is:

  • Launch DebugDiag
  • Cancel Wizard
  • Click "Processes" tab
  • Select w3wp
  • Right-click and select "Create full dump"
  • Snigger quietly to yourself because you said "dump"
  • Once dump is complete (snigger again), click "Advanced Analysis" tab
  • Use the 2 Memory Pressure Analyser scripts to see if you can see what objects are using a lot of memory.

I would advise doing this in combination with Uri May's answer, as otherwise you will likely waste a lot of time.