WeakValueDictionary
Brian Murphy-Dye
brian.murphydye at mac.com
Tue Aug 3 02:57:48 UTC 2004
When executing the code below, I expected both values to be garbage
collected, yet 's2' apparently isn't. Other attempts were using
'Smalltalk garbageCollect' and adding 's2' from another method (to make
sure the block context wasn't preventing garbage collection). Any
ideas?
| weakDict |
weakDict := WeakValueDictionary new.
weakDict at: 1 put: Object new.
weakDict at: 2 put: 's2'.
Smalltalk garbageCollectMost.
(weakDict at: 1) = nil ifFalse: ['at 1 not nil' inspect].
(weakDict at: 2) = nil ifFalse: ['at 2 not nil' inspect]. "=> shows an
inspector"
Thanks, Brian.
More information about the Squeak-dev
mailing list
|