I have a web part that loops through web apps, sites, and webs. I'm using DoesUserHavePermissions() to check whether or not the user has access to the site. I'm getting an error and I've made sure to dispose of any SPWebs and SPSites.

Is there a tool that I can use to check where the memory leak is happening?

5 Answers 5


Have you tried MS SharePoint disposal checker tool? http://archive.msdn.microsoft.com/SPDisposeCheck


Hope this help you out

In this article describes the best practices as well SharePoint dispose checker tool.



If you leak SPRequests (SPSite/SPWeb) in a Web Part then it'll listed in the ULS log (Use ULSviewer) to see that.

You can get more information about where the leak occured by setting CollectSPRequestAllocationCallStacks of the ContentService to true see SPRequest allocation callstack logging in SharePoint 2010 and WSS 4.0


Use SharePoint Code Check (SPCop - formerly known as SPDisposeCheck). This analyses memory leaks as well as controls (.ascx), pages (.aspx) and master pages (.master), stylesheets (.css), and JavaScript (.js). It works for SharePoint 2007 and higher.

This is the free component of the SharePoint Code Analysis Framework (SPCAF), which if you have the cash also provides reports, analyzers and more to test for and improve the quality of SharePoint custom development. I haven't used this so can't vouch for it.


Below link will show you the Easiest way for installing and using Dispose checker Tool


Also there are various reasons for performance issues and larger page load times.Check out the below link to see if you are Implementing all the below mentioned points


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.