[BUG][FIX] WeakGCFix-wbk

Andreas Raab andreas.raab at gmx.de
Tue Mar 23 00:52:44 UTC 2004


Hi Bryce,

> 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.

I left this running in a loop to throw an error if weakRef's value is ever
nil and so far it hasn't happened in several hundreds loops yet (it's slow
because of the full GCs). This makes me wonder if you are using some kind of
custom VM that you've built yourself - what platform, what VM *are* you on?

Cheers,
  - Andreas




More information about the Squeak-dev mailing list