destructors, how?

Allen Wirfs-Brock squeak-dev at lists.squeakfoundation.org
Wed Oct 23 00:23:13 UTC 2002


At 04:08 PM 10/22/2002 -0700, Andrew Berg wrote:
>It seems to me that it would be a workable comprimise
>to use finalization for those objects which get/got
>handed around and are hard to track, but then
>something like an ensure: block to clean up the ones
>where that is easy to do.  It seems to me that it
>would give you good performance in the common case,
>but then CYA (without requiring reference counting) in
>the complicated one.  Does this just not work out well
>in practice?

It's probably more appropriate to use finalization as a debugging aid to 
catch "leaks" in your connection resource management scheme. Remember that 
garbage collectors generally make no guarantees about their latency in 
running finalizers. You may empirically discover that your scheme usually 
works but you still won't want to be caught by a "phase of the moon" change 
in GC latency.  It's this unpredictability that generally makes 
finalization based resource recovery mechanism unreliable.

Allen_Wirfs-Brock at Instantiations.com 




More information about the Squeak-dev mailing list