>>finalize questions

John M McIntosh johnmci at smalltalkconsulting.com
Tue Aug 22 18:31:37 UTC 2006


On 22-Aug-06, at 3:10 AM, Michael van der Gulik wrote:

>>>
>>> I hope the small amount of time between loop iterations is enough  
>>> to get the GC to make the weak reference nil.
>> Unlikely. Once an object gets tenured, only a full GC will collect  
>> it:
>>     http://minnow.cc.gatech.edu/squeak/1469
>
> Ahh... I'd like to confirm that my approach indeed doesn't work,  
> even if I stick a 'Smalltalk garbageCollect' in the middle of it.  
> Argh.

Let me note that over the years I've had to fix a number of  
application for clients who were *hosed* because they were
abusing finalization because.

a) Finalization will happen, but later (when, is a good question?  
Milliseconds, to months...).

b) Finalization might not occur because of some issue with how the VM  
does the finalization,
perhaps a queue overflows, or a process crashes, or you hit a  
boundary condition, etc.

c) Finalization might not happen because someone resurrects the object.

Unless you accept these three points, then basing application level  
infrastructure on finalization is fraught with issues.




======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list