Scott Harris and Mike Ammerlaan have published a technical article entitled Using Disposable Windows SharePoint Services Objects. All SharePoint developers should consider this MSDN article a must read. Specifically, Scott and Mike are informing us that failing to explicity dispose of certain SharePoint Services objects can result in problematic server behaviors such as:
Several of the SharePoint Services objects use unmanaged code and memory to do the majority of their work. As such, classes like SPSite and SPWeb do not release from memory in a timely manner. Developers should explicity dispose of IDisposable objects such asSPSite and SPWeb when their applications finish using them. Moreover, developers cannot rely on the garbage collector to release them from memory automatically.
The 22 page MSDN technical article provides background on why it is necesarry to explicitly dispose of those objects which implement the IDisposable interface and further serves as an authoritative guide to the proper procedures for handling and disposing of SharePoint Services objects. Several techiques and best practice examples are given.