It's terribly important to remember that, even though you're writing code for a managed environment (.NET), you're not always dealing with managed objects; think of your MOSS objects (well, some of them anyway) as unmanaged resources that require special handling just like files and database connections. If you don't dispose of these objects properly, they'll sit in memory until the IIS application pool falls over and your site crashes. It happens and the existence of this article suggests it happens too much! The flip side is disposing of MOSS objects that shouldn't be disposed, which can also have negative consequences.
To coincide with this guidance, the SharePoint Dispose Checker tool (SPDisposeCheck) has also been released on the MSDN Code Gallery. Pointing this tool at your custom MOSS assemblies will tell you where you've gone wrong. The tool won't find every problem and may also report errors which are not actually problems but in general it's a great addition to your toolbox and a perfect compliment to the guidance. The tool can be used with MOSS or WSS assemblies. Note the -xml parameter doesn't work with this release--leave it off the call and pipe the output to a txt file.
The tool is installed to "C:\Program Files\Microsoft\SharePoint Dispose Check" and running against the sample spits out a list of problems that look something like this:
ID: SPDisposeCheckID_160
Module: SPDisposeExamples.exe
Method: SPDisposeExamples.SPWebLeak.SPLimitedWebPartManagerLeak
Statement: webPartManager := page.{Microsoft.SharePoint.SPFile}GetLimitedWebPartManager(1)
Source: C:\ROGERLA\Demo\SPDisposeExamples\SPWebLeak.cs
Line: 42
Notes: Dispose/Close was not called on SPLimitedWebPartManager.Web
More Information: http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx#SPDisposeCheckID_160
Interpreting the SPDisposeCheck's output isn't difficult but note the tool may output a lot of information before telling you about the problems encountered. Scanning the westernaustralia.com .dlls resulted in a 10MB text file to report three problems so I'd suggest you start reading the output file from the bottom up or run the tool without the -debug parameter. Also make sure you read the readme file as it's not only quite useful but brief.
Custom-Built Microsoft Office SharePoint Server 2007 Branded Sites and Webpart Development - info@mediawole.com