Most seasoned SharePoint developers have found out one way or another that you have to be mindful of properly disposing your SharePoint objects. Unfortunately, the rules, guidelines and general practices are often confusing and un-intuitive. Because of this it is common to find SPSite, and SPWeb objects that are not properly disposed. To help combat this issue Microsoft has released a tool called the SPDisposeCheck utility that will analyze your assemblies and report on any improperly disposed Shared Point objects.
The utility can be downloaded here:
To integrate the utility into your development environment, in Visual Studio go to the “Tools” menu and select the “External Tools” menu item. Select “Add” and configure the tools options as follows:
The command argument should point to the SPDisposeCheck executable. Pass the project BIN directory as an argument, and set the initial directory to your solution directory. Select the “Use Output window” checkbox so that the results from the tool display in the Visual Studio output window.
To use the tool, select a project in your solution, and then select the “SPDispose Checker” utility from your tools menu. The results from the tool will display in the output window. If you have any improperly disposed objects, the results in your output window will direct you to where the problems are located in the assembly.
More information about the proper disposal of SharePoint objects the following blog has a great deal of information: