Hello
Andreas Raab writes:
Hi,
Weak references can leave dangling pointers if the weak object is in old space and it points to a new space object.
Your observation troubles me greatly. This should not happen, and as far as I know it cannot happen. Do you have a reproducable example?
Try:
weakRef := WeakValueAssociation new. Smalltalk garbageCollect. "make it old" TestClass gcTest: weakRef Smalltalk garbageCollectMost. "incr. GC" weakRef value. "and it's now gone"
TestClass class>>gcTest: weakRef weakRef value: Object new.
By moving the new object creation out into it's own method we remove the risk of it getting captured but the context object.
Bryce