<div dir="ltr"><div><div><div><div><div><div><div>Hi all,<br></div>while porting MatFileReader to Squeak, I encountered this questionable behaviour:<br><br></div>I create classes on the fly for holding Matlab struct().<br></div>I want those classes to be garbage collected when no more used.<br><br></div>If I store the classes in a WeakArray, then this should normally not work:<br></div>I mean that the classes should not be reclaimed.<br></div>Why?<br>Because the metaclass points strongly to the class (via thisClass variable).<br></div><div>And the metaclass can't be reclaimed either, because it still has an instance.<br></div><div>That's what happens in Visualworks, classes put in a WeakArray are never reclaimed.<br></div><div>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).<br><br></div><div>In Squeak, I used a WeakValueDictionary, and to my surprise, discovered that the classes were reclaimed.<br></div><div>Is this a bug?<br><br></div><div>Nicolas<br></div><div><br><br></div></div>