Jon Skeet said:
Presumably because they don't get added to the form in quite the same
way - they're not actually controls, so they won't go into a list of
controls that the form keeps around.
This is correct. In Control.Dispose(bool), the .Net Control class calls
Dispose on all controls in the Control.Controls collection. This only occurs
within the branch of Dispose taken when it is not called from a Finalizer.
As Jon says, the Timer and ImageList are not controls, so they cannot be
places in the Control.Controls collection, and hence the base Control class
cannot take care of disposing them for you. This is why the template used by
VS for a Windows Form generates a components collection and a dispose for
the Form that will ensure the components collection is disposed as well.
I don't think that's a good idea, no.
It's a performance hit for starters. If you leave the controls to the GC,
you guarantee that you will have to wait longer for the resources to be
free, as well as for the memory of the objects themselves to be freed. This
is because it takes two rounds of the GC to fully collect a finalizable
object. Component.Dispose uses GC.SuppressFinalize, so disposing a Control
ensures that it will be collected in one GC, not two.
This means a non-disposed control is very likely to end up in Gen 2, which
is only rarely collected. So a non-disposed control can take significantly
longer to be collected than a disposed one, and hence any objects directly
or indirectly referenced by the control will take longer as well.
Niall