SharePoint Dispose Checker Tool

SPDisposeCheck is a tool that analyzes and check the objects that not released by CLR garbage collection and must be released by calling the Dispose() methods in custom SharePoint solution that uses a SharePoint object model.

SPDisposeCheck will check the assemblies and will let you know the memory leaks according to the Microsoft standards.

Note : SPDisposeCheck tool can’t work with .Net 4 framework and up so that it’s not working with SharePoint 2013.

SPDisposeCheck is a command line utility and called by the Visual studio add-in and to download it click here

During installation SPDisposeCheck , you should check all the default options that related to integrate SPDisposeCheck with visual studio 2010 as shown below.

SPDisposeCheck installation

After you finish the installation > you should found SPDisposeCheck from

  • Tools > SharePoint Dispose Check.

SPDisposeCheck Visual Studio.gif

I recommend to automatically dispose of SharePoint objects that implement the IDisposable interface by performing a C# using statement.

String str;

using(SPSite oSPsite = new SPSite("http://server"))
{
  using(SPWeb oSPWeb = oSPSite.OpenWeb())
   {
       str = oSPWeb.Title;
       str = oSPWeb.Url;
   }
}

Enjoy 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s