Mantis - Squeak
Viewing Issue Advanced Details
7350 Collections minor always 05-06-09 22:08 02-06-11 23:48
nicolas cellier  
closed 3.10.2  
none trunk  
0007350: WeakSet tend to grow because they don't recycle nil slots
When objects are reclaimed, they are replaced with nil in the WeakSet array.
However, due to implementation of #scanFor: these nilled-slots are never reused until the next WeakSet #grow.

Adrian Lienhard reported a nice example at [^]
Beware, nil slot cannot be recycled without taking care of possible collisions as developped in the squeak-dev thread above.

We must first take care to #fixCollisionsFrom: nilIndex.

Please find a fix attempt below. To be tested extensively!
 M7350-WeakSet-recycleNilSlots-nice.1.cs [^] (2,011 bytes) 05-06-09 22:10
 M7350-WeakSet-recycleNilSlots-nice.2.cs [^] (2,540 bytes) 05-06-09 23:43
 M7350-WeakSet-tests-nice.1.cs [^] (5,076 bytes) 05-06-09 23:44

nicolas cellier   
05-06-09 23:44   
Sorry, M7350-WeakSet-recycleNilSlots-nice.1.cs was bugged !
Try M7350-WeakSet-recycleNilSlots-nice.2.cs instead
nicolas cellier   
05-07-09 10:05   
"fix begin"
Installer mantis bug: 7350 fix: 'M7350-WeakSet-recycleNilSlots-nice.2.cs'.
"fix test"
Installer mantis bug: 7350 fix: 'M7350-WeakSet-tests-nice.1.cs'.
"fix end"
11-07-10 02:19   
The problem was solved in Squeak 4.1 in a different way. Slots are reclaimed during growing and removal. I integrated the tests to the Trunk.