.NET Framework Memory Leaks

When code you write relies on resources of a third party vendor, the performance and stability of your application may become dependent on code that is outside of your control. How can you detect and report when applications built on the .NET Framework (or any managed framework) are correctly handling unmanaged resources or are otherwise utilizing resources incorrectly?

Here’s an interesting article that I found that describes the various memory leaks that can occur:
Code Project

A post on MSDN summarizes the different methods of object disposal:

Methods of disposal
There are three methods for disposing of objects which require disposal.

1. Explicit call to the Dispose method



2. Implicit via the C# using statement (recommended method)


using(SolidBrush brush = new SolidBrush(Color.Yellow))
{ /* use the brush */ }

3. Finalization (not recommended)

Using a construct such as try/catch/finally is better than nothing. However, there are situations where the finally block will not be guaranteed to execute.