On Tue, 2008-06-17 at 16:16 +0200, Adrian Lienhard wrote:
Hi Norbert
Since there was nobody else replying on the Squeak-dev mailing list, what do we do? At least, my "fix" is not satisfying as it just works around the actual problem. But then I don't feel like diving into the finalization mechanism to fix it. I don't think its critical. I think we should just remove the test (like they did in 3.10).
I agree. At the moment there is only one method that calls it and that method itself does not have a sender. The only other solution I can see is to change Object>>finalizationRegistry and I wouldn't dare :) +1 Norbert
Cheers, Adrian
On Jun 14, 2008, at 12:23 , Norbert Hartl wrote:
On Sat, 2008-06-14 at 12:18 +0200, Stéphane Ducasse wrote:
No idea :)
may be ask in the squeak mailing-list?
You are right :)
Norbert
On Jun 14, 2008, at 12:03 PM, Norbert Hartl wrote:
Before I recognized that Adrian fixed the
ObjectFinalizerTests>>testFinalizationOfEquals
I gave it try myself. I came to the same conclusion as Adrian how to fix. But now after knowing how it works I do not know why the test succeeds :)
The test uses
1 to: 5 do: [:n | o := Object new. bag add: n. o toFinalizeSend: #remove: to: bag with: n]. 1 to: 5 do: [:n | o := Object new. bag add: n. o toFinalizeSend: #remove: to: bag with: n].
My problem is that toFinalizeSend:to:with adds an Objectfinalizer to the finalizationRegistry of the instance. But
Object>>finalizationRegistry "Answer the finalization registry associated with the receiver." ^WeakRegistry default
returns a global object which is WeakKeyDictionary. And
| d | d := WeakKeyDictionary new. d at: (1 asString copy) put: $a. d at: (1 asString copy) put: $b. d size
prints 1. To me that would exchange every entry from the first run by the second run (because the objects are equal).
So I would assume that if there does not happen a run of the garbagecollector between the two loops the objects of the first loop should be still contained in the bag. But the test is named finalizationOfEquals so I have to assume: self doesNotUnderstand
Can someone explain it to me, please?
Norbert
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project