When and what dispose

Author // Rogério Cruzeiro Categories // Brain Dump

Avoiding memory leaks general rules:

  1. Use SPDisposeCheck utility to identify issues (very usefully on analysing 3rd party code)

  2. Dispose when:
    1. Enumeration AllWebs or Webs
    2. OpenWeb()
    3. Anytime the new command is used

  3. Don't dispose when:
    1. ParentWeb
    2. RootWeb
    3. SPContext

About the Author

Rogério Cruzeiro

Being a qualified .NET and SharePoint Consultant, I have over 5 years of experience in Software Development, with special focus on collaboration and content management platforms, solution integration and business intelligence.

I'm particularly pleased to work with Microsoft technologies, especially with the SharePoint platform, ASP.NET, C# and PowerShell, and I'm always searching for new programming methods and for new ways of doing things more efficiently.

My strengths include:

  • SharePoint Development
  • .Net & Web Development
  • PowerShell Scripting
  • SharePoint Migrations
  • SharePoint 2010 Administration
  • SharePoint 2010 Configuration