Contents
Specifically, you should explicitly dispose those SharePoint objects that implement IDisposable when you are finished using them.
Where can I find instances of incorrect disposal of objects?
After you determine that incorrect disposal of objects might be causing SPRequest objects to proliferate and unnecessarily increase the memory footprint of your sites, you can find specific instances of incorrect disposal by looking for the following two entries.
Is the Dispose method the same as the close method?
The Dispose and Close methods for the SPWeb object and SPSite object function in the same way. The Dispose method calls the object’s Close method.
Which is the Dispose method in.net framework?
The Dispose method calls the object’s Close method. We recommend calling the Dispose method, instead of Close, because SPWeb and SPSite objects implement the IDisposable interface, and standard .NET Framework garbage collection calls the Dispose method to free any resources associated with the object from memory.
Do you need to dispose of all of your sprequest objects?
Yes you need to dispose of all of them. An SPRequest object was not disposed before the end of this thread. To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.
What does each instance of spsite and spweb contain?
Each instance of SPSite and SPWeb contains a reference to an SPRequest object that, in turn, contains a reference to an unmanaged COM object that handles communications with the database server.
SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the SPSite and SPWeb objects returned by SPContext.Site, SPContext.Current.Site, SPContext.Web, and SPContext.Current.Web.
When to use dispose checker in SharePoint?
This best practice addresses the issue identified by the SharePoint Dispose Checker Tool as SPDisposeCheckID_220. You must be cautious and aware of what the runtime is doing whenever you combine SharePoint object model calls on the same line. Leaks arising from this scenario are among the hardest to find.