Dispose refers to the cleaning up of resources used by an object during its lifetime. The .NET Framework is a garbage-collected runtime, which means this happens automatically, however SharePoint has a habit of maintaining its unmanaged resources, which may result in high memory usage if disposal is not performed manually.
Questions tagged [dispose]
70 questions
4
votes
2 answers
Does disposing SPSite dispose the SPWeb automatically?
Suppose we have code:
CASE 1:
using (SPSite site = new SPSite(SPContext.Current.Web.Url))
{
SPWeb web = site.RootWeb;
}
Do we need to dispose the SPWeb in this case?
CASE 2:
using (SPSite site = new…
variable
- 4,473
- 13
- 75
- 139
3
votes
3 answers
Can you provide a list of objects that needs to be disposed in SharePoint?
I need a list of SharePoint objects which need to be disposed.
This is for code analysis purpose. I have got a code review today and want a quick list of the objects to look out for in the code.
UPDATE
Here is what to dispose and what not to…
variable
- 4,473
- 13
- 75
- 139
3
votes
2 answers
Do I dispose the object?
I have been using SPDisposeChecker & reading through http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx but there are some conditions I am unsure of..
I believe this has become ok and the…
user13186
- 886
- 1
- 16
- 34
3
votes
2 answers
"Potentially excessive number of SPRequest objects" coming from Microsoft's own code?
In one of my SharePoint apps, I am getting this warning & stacktrace over and over (with different GUIDS): since it's only one of my apps, I assume there's something in my project's code, but SPDisposeCheck returns clean, and there's nothing in the…
Greg Hurlman
- 441
- 1
- 5
- 14
1
vote
1 answer
Dispose SPContext.Web
Normally it is not required to dispose SPWeb when it is obtained from the current context.
However what happens if I create the context on my own?
SPContext spContext = SPContext.GetContext(httpContext);
SPWeb web =…
driAn
- 247
- 2
- 7