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 ...

learn more… | top users | synonyms

2
votes
2answers
34 views

SharePoint 2013 Dispose checker

I've used SPDisposeCheck for SP2007/2010 and find it very useful for finding undisposed sp objects, but from this blog post, it's mentioned that it's no longer working for 2013. Is there any ...
0
votes
1answer
51 views

SPContext.Current.Web.ParentWeb needs disposing?

I am using SPContext.Current.Web.ParentWeb and I want to know if I have to dispose below: SPContext.Current.Web.ParentWeb
2
votes
2answers
369 views

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: ...
1
vote
3answers
152 views

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.
1
vote
1answer
164 views

Will searching SPWebApplication.Sites with Linq need to be diposed?

Situation: I only have the full URL of an image in our farm & no knowledge of where it comes from other than being in the web application so I need to locate the site/web/list/item segments. ...
0
votes
0answers
17 views

SharePoint 2013 - disposing SP.ClientContext in JavaScript [duplicate]

I'm little bit confused about JS's COM in SharePoint 2013 and disposing ClientContext object. As far as I can see from earlier versions of SP (2010 mainly) you had to dispose ClientContext and ...
1
vote
1answer
2k views

How to correctly dispose spweb and spsite on powershell foreach!

Title of the question is pretty simple, I have 18000 site collections and this script is showing 1GB of ram used, so I wonder how can I dispose correctly the spweb and spsite object $webapplication = ...
5
votes
3answers
1k views

An SPRequest object was not disposed - determine where this object was allocated

I have the SPRequest object was not disposed error. 12/10/2013 14:21:03.03 w3wp.exe (0x260C) 0x1700 SharePoint Foundation Performance nask ...
3
votes
3answers
184 views

What is the correct way of disposing these webs

I've been trying to find documentation on how to correctly dispose webs and sites and I've come across this article which is quite good, but doesn't seem to cover all my scenarios. My specific ...
0
votes
0answers
54 views

Event Reciever Object Disposal Issues

I am getting this error after adding a document to a library that has a custom event receiver associated with it: An SPRequest object was not disposed before the end of this thread. To avoid ...
0
votes
1answer
285 views

Do I need to dispose a SPWeb or SPSite object from a WorkflowContext

I'm working on a Custom Workflow activity. In the activity I use the WorkflowContext-object. From this object I get the current SPSite or SPWeb via the Site and Web properties of the WorkflowContext. ...
3
votes
2answers
80 views

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 ...
1
vote
2answers
78 views

When to call Dispose if passing SPContext.Site to a class library?

I'm just looking for a bit of sanity check on this one! I'm looking at many classes that have SPSite or SPWeb as a constructor for the class. The class is instantiated using SPContext.Site as the ...
3
votes
2answers
154 views

Sharepoint 2013 Dispose in linq

I'm wondering if this needs to be disposed or if it's a bad method to get the title of a web. var currentWebApp = SPContext.Current.Site.WebApplication; IEnumerable<SPSite> allTeamSites = ...
0
votes
1answer
52 views

Will the code be leaking

I've wrote here a code for SharePoint 2007 to modify few items through out of all site collections in web app, my question is the code written good, or is there a leak somewhere, and i could improve ...
0
votes
1answer
270 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 ...
3
votes
3answers
836 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
264 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
114 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
1answer
109 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
872 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 ...
2
votes
3answers
99 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 be made on it? Example: public void TheCallingFunction() { SPSite site = ...
2
votes
2answers
357 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
4answers
4k 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
575 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
353 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
1k 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
3answers
610 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
2k 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
626 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 ...
2
votes
2answers
928 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
656 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 ...
9
votes
2answers
2k 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
442 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
848 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
126 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 ...
13
votes
1answer
684 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 ...
5
votes
2answers
1k 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
869 views

What tool to use to check memory leaks in SharePoint

Currently I encounter memory leaks 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.
6
votes
2answers
384 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
132 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)) { ...
28
votes
2answers
7k 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.
2
votes
1answer
968 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 = ...
3
votes
4answers
2k 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?
5
votes
3answers
2k 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
2k 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 ...
1
vote
1answer
319 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) ...
2
votes
2answers
88 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
130 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
680 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 ...