Find a memory leak application on SharePoint

If you’re going to look for memory leaks, you need Performance Monitor (perfmon).


Here is a method you can use to detect memory leaks:


First open Perfmon and select the .NET CLR Memory Performance object and the counter # Bytes in all Heaps for all your w3wp instances (w3wp#1, w3wp#2, etc).


With these counters you will be able to see if any w3wp process is accumulating memory. Leave this running for some hours and you will notice rapidly.


Now once you have determined a w3wp process that is leaking, you need to clearly identify it. Of course the w3wp#1 notation, isn’t helping here. So you need to find out what does it correspond to. In my previous post, I already mentionned that you can find out the Web Application if you have the Process ID. Clearly, in this case, we still need to find the process ID.


I have come across 2 methods for this:


1. You can set a registry key on your server(s) that will translate the w3wp#1 into w3wp_pid. See KB281884 for this (I hate setting registry keys if it can also be done without [:D] )


2. You can also find out this information using perfmon! Add the Performance object Process with the counter ID Process and for the instance of w3wp#… for which you want to know the pid. And voila, you get the Pid. 


Now, using cscript iisapp.vbs you can find out the Web application that is leaking. With this information you can then check which solutions are deployed to this web application and you can already start with the fingerpointing [6] !


I want to thank my good friend and colleague Cedric Carrette for sharing this information with me.


 

2 thoughts on “Find a memory leak application on SharePoint

  1. Hi Dirk,
    Thank for this post, however I’m not very clear on how you figure out which w3wp is leaking. I have made changes in the registry, readded all the counters (both Process/ID Process and .NET CLR Memory/Bytes in all Heaps but I still can’t identify which is which). could you please elaborate a little on this point?
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *