The dispose tag has no wiki summary.
6
votes
1answer
297 views
Memory leak in Microsoft.Sharepoint.Taxonomy.TaxonomyItemEventReceivers?
I've been trying to locate some memory leaks we've noticed in our ULS (EventID: nask, An SPRequest object was not disposed ... etc).
On my dev environment, and at least 2 other cleaner installs, the ...
0
votes
1answer
39 views
PowerShell - Dispose SP Objects
I want to use PowerShell to loop through my SharePoint and dispose all objects properly.
I don´t want to generate entrys in the SharePoint log like this:
An SPRequest object was not disposed ...
1
vote
2answers
70 views
Dispose in Client Object Model
Should objects be disposed when using the client object model? If so, which ones? There seems to be plenty of information on this for server side, but nothing from Microsoft specifically about ...
1
vote
1answer
69 views
Implications of open SPWeb/SPSite
I have read in various places that un-disposed SPWeb/SPSite objects keeps valuable database connections open and large COM objects in memory. Not disposing those objects is like number one mistake ...
0
votes
2answers
68 views
How to properly dispose of sp 2007 object in powershell?
First and foremost I've done A LOT of googling and even went past the first page or 2 :) so feel free to direct me to the proper post if necessary.
I am trying to loop through a bunch of webs and ...
0
votes
4answers
882 views
Detected use of SPRequest for previously closed SPWeb object after SPQuery
this code run yesterday very well and today I've been trying to solve this error for hour now :
Please close SPWeb objects when you are done with all objects obtained from them, but not before
I ...
0
votes
1answer
49 views
Could these errors be the cause of my timer job problem?
I have a timer job that runs every night at midnight.
The first part of the timer job is to iterate through every single site in a particular site collection (there are many).
The second part of the ...
0
votes
1answer
177 views
Detected use of SPRequest for previously closed SPWeb object
I've got an event receiver that fails, seemingly inconsistently. I've checked the ULS logs and I can see the 90hv Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb ...
1
vote
3answers
46 views
To Dispose or Not to Dispose - IDisposable Passed as Function Parameter
If an IDisposable SharePoint object is passed into a function, does an explicit Dispose() call need to made on it?
Example:
public void TheCallingFunction()
{
SPSite site = ...
2
votes
2answers
149 views
Does SPWeb.Delete() Dispose of the object?
I recently got a comment on my Deleting a site with subsites programmatically article about properly disposing of SPWeb objects after they've been deleted:
Don’t forget to dispose the deleted web.
...
0
votes
1answer
477 views
“Detected use of SPRequest for previously closed SPWeb object” within Event receiver but no error when run in test harness
I have a very strange issue which I cannot explain. We have and event receiver and within this we instantiate our own class that does all the work we need it to do. As part of this we pass in an SPWEB ...
0
votes
1answer
226 views
Dispose SPWeb object in recursive function
I have updated my code as per suggestions from suggestions on my earlier question , I still see the error message for one of my recursive function.
Below is the code snippet to recursively loop ...
0
votes
3answers
277 views
SPSite and SPWeb object dispose inside foreach loop
I have a code that loops through all the Sites and Webs in a web application. My code uses for..each loop to navigate through each site and web object.
I was wondering if we are required to dispose ...
2
votes
2answers
262 views
Disposing item.web
I have read this article and known which objects should be disposed. But I doubt whether oItem.Web returns the same object as spcontext.current.web object or it creates new one. If it creates new, I ...
0
votes
2answers
820 views
best practice dispose parentWeb on feature activated, how to fix it in this scenario?
I am getting a warning from the spdisposecheck in one method I executed on the feature activated event.
private void CopyAttendees(SPWeb currentWeb)
{
try
{
SPWeb parentWeb = ...
2
votes
4answers
351 views
What are the dangers of disposing of SPWeb when it's automatically disposed of?
In some cases such as:
using (SPSite site = new SPSite(@"http://sitecollection/"))
{
SPWeb web = site.RootWeb;
}
you don't need to dispose of the SPWeb object because it is disposed of ...
0
votes
0answers
139 views
List Definition with Managed Metadata field disposes the SPWeb
I have encountered a very strange behaviour twice now, on 2 different SharePoint Server 2010 installations over the last year (I cannot state excatly which CU but fairly recent versions).
When I have ...
2
votes
2answers
455 views
Dispose of SPItemEventProperties at the end of an event receiver?
Is there any need to call
properties.Dispose();
at the end of an event receiver? Would this prevent memory leaks? Is this unnecessary? Is it best practice?
0
votes
1answer
327 views
Proper use of SPWeb from SPContext for pulling lists
So, after about two hours on the subject I am thoroughly confused. There are viewpoints all over the place on how, when, and why to use Dispose() on SPWeb objects as they relate to SPContext.
Can ...
8
votes
2answers
1k views
SPWeb being closed when getting list by powershell. What's wrong?
When I run this little piece of powershell code:
$w = Get-SPWeb http://localhost
$l = $w.List["some list"]
I get Unexpected error message to my Sharepoint ULS log
Detected use of SPRequest for ...
1
vote
1answer
228 views
Dispose issue when working with content types
I am seeing an issue with un-disposed SPRequest objects in the ULS logs when i work with content types in the object model.
My code is as follows (in previous methods run as part of this request, the ...
2
votes
3answers
531 views
SPDispose false positive
I got many warnings from the SPDispose checker like this:
ID: SPDisposeCheckID_140
Module: xx.xx.dll
Method: xx.xx.Layouts.xx.UpdateWorkspace.Page_Load(System.Object,System.EventArgs)
Statement: ...
2
votes
1answer
90 views
Will this code lead to an object not being disposed?
Say I have the following code:
SPList promo1List = site.WebApplication.Sites[0].RootWeb.Lists.TryGetList("promotions");
Will this lead to the SPSite object Sites[0] not being disposed? I ran ...
4
votes
2answers
605 views
Will passing SPWeb as by value parameter cause a memory leak?
I have an issue in my SharePoint environment and I suspect that this code causes a memory leak. I'm passing a SPWeb object as a value parameter.
Will the SPWeb object instance get disposed correctly ...
2
votes
2answers
421 views
What tool best help to identify memory leak?
Currently I encounter memory leak in my SharePoint 2007 application, what is the best tool to identify is there any un-dispose objects in the codes? example like DataTable, SPWeb, or SPList.
Thank ...
5
votes
2answers
667 views
Do you have to dispose of the SPWeb in the EventReceiver when using properties.OpenWeb()?
Does properties.OpenWeb() create a new SPRequest object or does it refer to the existing SPWeb object already there in the properties object? Should we manually dispose of the SPWeb obtained in this ...
1
vote
1answer
447 views
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 = ...
2
votes
2answers
5k views
“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 ...
5
votes
3answers
2k views
Disposal of SPWebs retrieved from SPContext.Current.Site.AllWebs
As there was a minor disagreement on whether SPWebs retrieved from SPContext.Current.Site.AllWebs should be disposed, I thought it would be appropriate to post a new question and discuss it here.
I ...
22
votes
2answers
3k views
When to use OpenWeb() vs RootWeb
I am a little confused on the pro's and con's of each. When is it good to use OpenWeb() vs RootWeb, especially in the context of a using statement.
6
votes
2answers
221 views
Is it bad to dispose an object twice?
With all the focus on disposing all disposable objects in SharePoint, I wondered if there is any harm in disposing an object twice. Especially since SharePoint seems to do some disposing itself too. ...
2
votes
3answers
127 views
4 using statements looks messy? Any suggestions on what is a better way to code this?
Imagine the following code:
using (SPSite spSite = new SPSite(this.SiteURL))
{
using (SPWeb spWeb = spSite.OpenWeb())
{
using (SPSite spSite2 = new SPSite(this.SiteURL2))
{
...
2
votes
1answer
712 views
Disposing of objects in an Event Receiver
I have an ItemUpdated event receiver running on a library. Some pretty basic logic. Here's the gist of what I'm doing:
SPWeb web = properties.Web;
SPContentTypeId ParentCT_Id = ...
1
vote
1answer
251 views
ParentWebId: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007
Following the guidance below (1) to ensure that the stack trace of the allocation of the SPRequest object is preserved in memory and added to the ULS logs, I'm seeing a steady stream of 8l1n (High) ...
3
votes
4answers
639 views
How to properly use the Using Statement with SharePoint Objects
What is best practice with the Using statement when working with SharePoint Objects. When and how should you use the Using statement, so objects used are disposed, etc?
4
votes
3answers
1k views
Should I dispose SPWeb or SPList?
I am doing a whole bunch of things with one SPWeb and many SPLists. If I just dispose web in the finally section would that dispose all of SPLists that I instantiated? (btw, I understand the concept ...
11
votes
3answers
1k views
Should I dispose these SPSite and SPWeb objects?
Is it necessary to dispose the site and web objects in the following code? If so, how do I do this?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim site ...
2
votes
2answers
80 views
SPDisposeChecker, is this a false positive?
We have the following code:
foreach (SPWeb website in collectionOfWebSites)
{
// Some code, no dispose of website
}
SPDisposeChecker is reporting it as a memory leak. Should ...
1
vote
1answer
119 views
How to properly dispose of SP objects although not assigned?
If I assign SPContext.Current.Site.OpenWeb().Title to a string, do I need to dispose of it (if possible)?
string title = SPContext.Current.Site.OpenWeb().Title;
I'm still a little fuzzy on when to ...
1
vote
4answers
643 views
Does this leak? SharePoint SPSite and SPList code
Would this code cause an SPList object to leak? It's enclosed in a Using statement but that's in a sub routine.
String site = "http://server/sites/site";
foreach (string s in ...
2
votes
2answers
2k views
Warning of undisposed objects in Microsoft's own SharePoint code
I found many 8l1n warnings of undisposed objects in the SharePoint ULS logs.
The interesting thing is that the entire stack trace does not show anything in my code.
I am not sure what to look for in ...
1
vote
1answer
531 views
Memory Leak - Disposing SPSite and SPWeb?
So I read through another post here http://www.sharepointoverflow.com/questions/1047/disposal-of-spwebs-created-using-spsite-openweb.
Currently I only dispose of the SPSite object, and from my ...
3
votes
5answers
2k views
Disposal of SPWebs created using SPSite.OpenWeb()
After reading some answers/comments on Disposal of SPWebs retrieved from SPContext.Current.Site.AllWebs, I opened up Reflector to dig deeper into the SPSite and SPWeb classes.
I ran into a surprise, ...



