[squeak-dev] Suspiscious "weak" value reclaimed

Bob Arning arning315 at comcast.net
Mon Mar 26 21:15:50 UTC 2018

Other that the WeakValueDictionary, is there anything referencing either 
the class or metaclass? If not, then they would be collected. Perhaps VW 
is saving a reference elsewhere?

On 3/26/18 3:07 PM, Nicolas Cellier wrote:
> Hi all,
> while porting MatFileReader to Squeak, I encountered this questionable 
> behaviour:
> I create classes on the fly for holding Matlab struct().
> I want those classes to be garbage collected when no more used.
> If I store the classes in a WeakArray, then this should normally not work:
> I mean that the classes should not be reclaimed.
> Why?
> Because the metaclass points strongly to the class (via thisClass 
> variable).
> And the metaclass can't be reclaimed either, because it still has an 
> instance.
> That's what happens in Visualworks, classes put in a WeakArray are 
> never reclaimed.
> Fortunately, there is some Ephemeron support in VW to work around this 
> (such loop are detected by ephemerons, and strong references by some 
> object ephemerely pointed to does not count).
> In Squeak, I used a WeakValueDictionary, and to my surprise, 
> discovered that the classes were reclaimed.
> Is this a bug?
> Nicolas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20180326/af8d23ed/attachment.html>

More information about the Squeak-dev mailing list