Using Disposable WSS objects – Best and Bad Practices

The objects in the Microsoft Windows SharePoint Services (version 3) object model serve as an interface for working with Windows SharePoint Services data and configuration. Frequently, developers call into the object model to read or write new data in the Windows SharePoint Services store.

The Windows SharePoint Services object model contains objects that implement the IDisposable interface. You must take precautions when using these objects to avoid their long-term retention in memory in the Microsoft .NET Framework. Specifically, you should explicitly dispose of those SharePoint objects when you are finished using them.

In scenarios in which you use SharePoint objects extensively—for example, in SharePoint sites that use custom Web Parts—you can cause the following unusual behaviors by not disposing of those objects that can be disposed of:

  • Frequent recycles of the Microsoft Windows SharePoint Services application pool, especially during peak usage
  • Application crashes that appear as heap corruption in the debugger
  • High memory use for Microsoft Internet Information Services (IIS) worker processes
  • Poor system and application performance

This article serves as a guide to the proper procedures for handling and disposing of SharePoint objects

Best Practices: Using Disposable Windows SharePoint Services Objects

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s