E
Elisa
Hi,
As Pocket PC's are (supposed to be) resource-restricted devices, I
thought it would be wise to implement an agressive disposing strategy,
i.e. add IDisposable to every class, and call Dispose() on everything.
But I don't know exactly HOW agressive I need to be ;-)
I.e.:
- If I derive from Panel or Form, and a child controls
(Me.Controls.Add...), do I need to remove and dispose those as well, or
do Panels and Forms somehow dispose of their children themselves?
- If I add objects to a Collection, do I need to enumerate over the
collection and call Dispose() on every object, or should a
Collection.Clear() accomplish the same thing?
- If I add a handler (AddHandler obj.event, delegate), do I need to
remove the handler myself when I want to dispose of the object?
I assumed that all the above would be taken care of automatically by the
garbage collector, but some of my objects start threads, and these
threads are stopped in their Dispose() method (via a simple
stopThreadRequested boolean flag). Yet if I quit my application, these
threads appear to still be running, so it looks as if my Dispose()
methods aren't called automatically...
Regards,
Elisa
As Pocket PC's are (supposed to be) resource-restricted devices, I
thought it would be wise to implement an agressive disposing strategy,
i.e. add IDisposable to every class, and call Dispose() on everything.
But I don't know exactly HOW agressive I need to be ;-)
I.e.:
- If I derive from Panel or Form, and a child controls
(Me.Controls.Add...), do I need to remove and dispose those as well, or
do Panels and Forms somehow dispose of their children themselves?
- If I add objects to a Collection, do I need to enumerate over the
collection and call Dispose() on every object, or should a
Collection.Clear() accomplish the same thing?
- If I add a handler (AddHandler obj.event, delegate), do I need to
remove the handler myself when I want to dispose of the object?
I assumed that all the above would be taken care of automatically by the
garbage collector, but some of my objects start threads, and these
threads are stopped in their Dispose() method (via a simple
stopThreadRequested boolean flag). Yet if I quit my application, these
threads appear to still be running, so it looks as if my Dispose()
methods aren't called automatically...
Regards,
Elisa