[squeak-dev] Finalization tests failing

Igor Stasenko siguctua at gmail.com
Sun Oct 31 17:16:08 UTC 2010


On 31 October 2010 18:34, Levente Uzonyi <leves at elte.hu> wrote:
> On Sun, 31 Oct 2010, Igor Stasenko wrote:
>
>> On 31 October 2010 05:50, Levente Uzonyi <leves at elte.hu> wrote:
>>>
>>> On Sun, 31 Oct 2010, Igor Stasenko wrote:
>>>
>>>> Hello,
>>>>
>>>> under VM with new finalization, some tests are failing.
>>>> Please, check
>>>> http://code.google.com/p/pharo/issues/detail?id=3183
>>>> for details.
>>>>
>>>> it looks like i need to do a different changeset for Squeak
>>>
>>> Why? Are the tests failing in Squeak? The patches you attached to the
>>> issue
>>> are both related to Pharo's crappy WeakKeyDictionary implementation.
>>>
>>
>> i'm afraid no.
>> Squeak weak dictionary does not overriding associations with nil keys,
>> which means that it will grow bigger and bigger when you run image
>> under VM with new finalization.
>
> No, it won't. During growing the associations with nil keys will be
> finalized and removed from the WeakKeyDictionary. The same also happens if
> you remove an association. In this case the association's chain will be
> affected. See #noCheckNoGrowFillFrom: and #fixCollisionsFrom:.

okay.. then there is no need to change anything in Squeak.
Because at either grow or shrink , it will wipe all associations with nil keys.

>
> There will be another problem with the current implementation of the new
> finalization scheme. Since the new WeakRegistry doesn't remove the
> associations from the dictionary, the installed finalizer (#finalizeValues)
> will be evaluated with the already finalized WeakFinalizerItems. This may
> cause early finalization or raise an error. The easiest way to avoid this is
> to use a better finalizer which does nothing if the VM supports the new
> finalization scheme.
>
No, that's actually not a problem. A finalizer item wipes an executor
object , by setting it to be nil.
So, next time you may send #finalizeValues to finalizer item, it will
send #finalize to nil,
which is no-op.
Thus there is no chance that same object will be finalized twice.
See WeakFinalizerItem>>finalizeValues

>
> Levente
>
>>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list