Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Currently I encounter memory leaks in my SharePoint 2007 application. What is the best tool to identify is there any un-dispose objects in the codes? Example like DataTable, SPWeb, or SPList.

share|improve this question

2 Answers 2

You can use the SharePoint Dispose Checker Tool from Roger Lamb ((blog)[http://blogs.msdn.com/b/rogerla/archive/2010/12/13/announcing-spdisposecheck-v14-0-4762-1000-update-for-sharepoint-development.aspx]). Also, some updated guidance can be found at this msdn page.

A little notice: when using the aforementioned tool, beware that it will often report false positive. The tool only performs static checks, so it won't detect if an object is disposed outside the current method (common scenario: you pass a SPWeb/SPSite instance as a method parameter - SPDisposeCheck will often report the object as undisposed). Also notice that the tool is not updated very often so there may be some undetected issue. In that case, as far as I know, your best bet is to resort on the ULS logging infrastructure, collect the undisposed request stack traces an work your way from there.

share|improve this answer

To check for possible memory leaks in your code, You can use SPDisposeChecker tool.

To check if the memory leaks are exisitng in the SharePoint farm :

1) Watch ULS Logs for the large no of errors like :

"An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as a SPSite or SPWeb) as soon as you are done using it. This object will now be disposed"

2) Watch if there is frequent Application pool recycle.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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