I feel ridiculously dumb to admit this but I didn't know for a while that System.Windows.Forms.Form implements IDisposable. So I managed to spend a few years writing code that created and displayed forms that were never disposed. This obviously created some memory leaks in my apps... *face palm*
If you are displaying a form once then moving on, wrap your form reference in a using statement.
using(MySuperForm myForm = new MySuperForm())
{
dmyForm.ShowDialog();
}
If a using statement isn't appropriate, have your class implement IDisposable and clean up after itself.
public class MySuperClass : IDisposable
{
private MySuperForm _myForm;
public void Dispose()
{
if(_myForm != null)
_myForm.Dispose();
}
}