Download location: http://code.msdn.microsoft.com/spdisposecheck
I’m happy to announce SPDisposeCheck v14.0.4762.1000 was updated and released today 12/13/2010.
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.
The SPDisposeCheck updated tool remains a standalone command line utility and we’ve added a Visual Studio 2008/2010 IDE Add-In which calls out to the SPDisposeCheck. This Add-In was originally presented at the SPC 2009 and is now available publically. In addition this version has been tested with both WSS 3.0 + MOSS 2007 and SharePoint 2010 (Foundation and Server) environments.
Finally, we have added several checks on when “NOT” to Dispose objects instantiated by SharePoint internally. These newly reported “DO NO DISPOSE” (DND) rules were unreported by SPDisposeCheck v1.3.* . We would encourage you to run the updated SPDisposeCheck tool on all customized SharePoint projects to help identify areas in code which may lead to memory pressure and server stability issues. As a best practice you should consider adding this tool to your SharePoint software development life cycle build process and review its output with a subject matter expert on a regular interval.
I plan on posting a follow up on some code examples of when not to dispose object following this initial announcement.
Reference list of Do Not Dispose Rules checked:
Special thanks to the SPDisposeCheck core development team: Sean Thompson, Greg Varveris, Paul Andrew, and Stefan Goßner !