June 28, 2012 by Ruaan Harmzen
You ever wonder why your Sharepoint environment sometimes just suddenly starts pumping out correlation ids?
One of the causes could be some memory leaks in your environment and this typically is caused by custom developed web parts. You are a bit safer with sand boxed solutions, however they also do tend to give problems.
Sharepoint is complex by nature and development in Sharepoint even more. If you do not properly dispose of the objects you use in code it will lead to memory leaks. It does not matter how good you are at coding, it is very easy to miss where to dispose objects in Sharepoint.
The solution is simple. Download the SPDisposeCheck tool from Microsoft and run against your customer Sharepoint code. It installs to the Tools menu of Visual Studio. It has some basic settings as shown below (I suggest you run it ad-hoc when you are ready to deploy and not on every build)