[squeak-dev] WeakArray and use of weak collections.
Gary Chambers
gazzaguru2 at btinternet.com
Mon Feb 25 19:38:52 UTC 2008
Aye. The fix I jusggested keeps them from getting out of hand. I have modified our synchronization framework to allow per-instance maps too (rather than weak), rather like I've modified Morph to have per-instance (via properites) action maps for events.
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org]On Behalf Of
> Philippe Marschall
> Sent: 25 February 2008 7:23 PM
> To: The general-purpose Squeak developers list
> Subject: Re: [squeak-dev] WeakArray and use of weak collections.
>
>
> 2008/2/25, Gary Chambers <gazzaguru2 at btinternet.com>:
> > Today I've had "fun" trying to fix a problem with our software
> (that uses
> > many processes running at various priorities). Due to the use of a
> > WeakIdentitykeyDictionary I was running into problems witht
> the dictionary
> > having multiple identical keys... not pleasant, especially
> when it gets to
> > around 27000 entries (should be 20).
> >
> > I have traced the problem to the fact that finalisation is not
> thread-safe
> > with respect to access of said dictionary. As a fix I have
> implemented a
> > #critical: method on the WeakArray class that evaluates the
> given block with
> > a #critical: call on the FinalizationLock of WeakArray.
> >
> > Access to the weak dictionary is now wrapped with a WeakArray critical:
> > [...] and the problems have, thankfully, disappeared.
> >
> > I can post a Mantis entry for this if you all think it is
> appropriate. Just
> > wondering how many other places in existing Squeak code might
> trip up on
> > this.
>
> In general weak array finalization will kill you sooner or later
> anyway. One of the big performance improvements in Seaside is removing
> WeakIdentitykeyDictionarys. We could simply not live with the fact
> that at one point the image will block for 20 minutes and hog the CPU.
> We now use more memory because we reclaim space later but do not block
> the image for minutes anymore.
>
> Cheers
> Philippe
>
More information about the Squeak-dev
mailing list
|