SharePoint is a fast-growing platform, more and more lists and documents need be managed may cause SharePoint performance issue. How to avoid SharePoint performance issue? You can use tools to monitor it during develop SharePoint AddIn.
-
SharePoint Dispose tracker tool
SPDisposeCheck is a tool that helps developers and administrators check custom SharePoint solutions that use the SharePoint Object Model helping measure against known Microsoft dispose best practices. This tool may not show all memory leaks in your code and may produce false positives which need further review by subject matter experts.[1]
-
Install SharePoint Dispose tracker tool.
Make sure you have installed Microsoft visual Studio 2010. Then run installer file SPDisposeCheck.exe.
After install successfully, you will able to find SPDisposeCheck Addin in Visual Studio 2010 Tools menu.
-
Configure the project what you analyze
Click SharePoint Dispose Check, get SPDispseCheck setting form.
Select the project what you analyze and treat problem type.
Check “Execute After Build” and the assemblies to analyze file.
Save it.
-
Analyze the code
Open the project, then check below code.
Build the project, the SPDispose Check tool will execute auto.
Go to View menu->Error List. You will see the error; this reason is in this code I did not disposed the objects properly.
Double click the error, you will locate to the incorrect code. Then you are able to correct it.
You also can get help to how to fix the error by select “Show Error Help” in right-menu of the error.
After click Show Error Help, will auto direct to the page(http://blogs.msdn.com/b/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx)
Fix above code according to the help.
Recheck the code, no error appear.
Index: