Any SharePoint developer with about a days worth of SharePoint development knowledge tends to find out that you need to dispose of the SPWeb and SPSite objects.  Of course this is further conveluded by the fact that this isn't ALWAYS the case depending on whether your a webpart or not, context, etc. etc.

I was answering a few forum postings this evening when someone asked the question again, whether or not they should dispose something in a certain case. I think I sufficiently answered their post on the MSDN forum.

I thought that I would share the info again though on my site so that I can easily link to it later.

Roger Lambs SPWeb/SPSite dispose write up
Roger Lambs SPWeb/SPSite dispose when using try/finally blocks
Steve Gossner's SPWeb/SPSite dispose write up has some good tidbits about other objects that need disposing
MSDN's SPWeb/SPSite dispose write up

In addition MS is coming out with a tool that is basically like FxCop that will check for SPWeb/SPSite objects, but its not out yet. MS SharePoint Team Blog  word on the street is that its coming out very soon.

The tricky thing that most of the articles don't really discuss that much, is when you use statements like"item.ParentList.ParentWeb.RoleDefinitions" that it technically creates an SPWeb object in your method when you call the ParentWeb. You therefore should probably break that line out to something like


using(SPWeb parent = item.ParentList.ParentWeb)

{

//your code here

}


Tony Testa posted on January 14, 2009 18:53

So Adobe has finally decided it was time to release a 64bit PDF iFilter.  How it took them this long to release or WHY it took this long for them to release it, i'll never know.  Check it out on their site

http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025

 

I went through the pain of hacking together their 32bit iFilter to work on 64bit and frankly it was a pain in the butt, so this is a welcome addition for me.  I have yet to actually try it out, but as soon as I get the chance, I'll update this post.

 

Side note, FoxIt (who's PDF reader I use everyday) has had a 64bit iFilter for I don't know how long now, but awhile.  I think its free for dev use, and only a few K for production use.  Apparently in testing, the FoxIt iFilter is faster than the Adobe (but this claim was pre-adobe 64bit iFilter, so i'm sure that might change things).  Check it out

http://www.foxitsoftware.com/pdf/ifilter/


Posted in: Sharepoint  Tags: , , ,
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017 Tony Testa's World