Ye Myat Aung
Ye Myat Aung

Reputation: 1853

Find memory leak in ASP.NET Web App

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?

Upvotes: 9

Views: 11926

Answers (3)

mike nelson
mike nelson

Reputation: 22166

In windows task manager you can see which app pool is running each w3wp.exe simply by showing the "user" column. This is because each app pool typically runs with its own user. They made it a bit harder to see this in Windows 2012 server - you need to click on "details" tab first.

Upvotes: 0

RB.
RB.

Reputation: 37222

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.

Upvotes: 21

Uri May
Uri May

Reputation: 365

You can configure each web site to use different app pool, that way you'll have a w3wp.exe process for every web site of the 7 websites you host. After that you can use the tool in the following this link to find out which of the websites is causing the leak by tracing the PID of the w3wp.exe with biggest memory consumption.

Upvotes: 2

Related Questions