Stefan Goßner

Senior Escalation Engineer for SharePoint Products and Technologies

SharePoint 2007 and WSS 3.0 Dispose Patterns by Example

A couple of weeks ago I wrote an article which explains how to deal with memory pressure situations in MOSS/WSS.

Roger Lamb has now created an article which discusses one of the issues – missing Dispose() or Close() for SPWeb, SPSite and PublishingWeb objects. When to dispose and when not to dispose can be confusing as there are situations where a dispose is required and other where this is not required.

Roger shows in his article SharePoint 2007 and WSS 3.0 Dispose Patterns by Example lots of code samples which demonstrate exactly when to use dispose and when it is not necessary or even more: when it should not be done.