[BUG][FIX] WeakGCFix-wbk

Andreas Raab andreas.raab at gmx.de
Mon Mar 22 00:23:03 UTC 2004


> This bug can, and does, cause VM crashes. An example crash
> output is included below. All the examples I've seen have
> involved the object dependency mechanism.

Hm ... actually the log is pretty interesting. WeakKeyAssociation is a class
which specifically prevents creating "old weak references" by:

WeakKeyAssociation>>key: aKey
    key := WeakArray with: aKey

So the key is already there when the weak array is created and since Squeak
allocates memory montonically it means that the WeakArray will come "after"
the object it points to in memory. And since Squeak tenures equally
monotonically, it will have the key tenured before the weak reference. In
other words, by the way WeakKeyAssociation works it is impossible[*] to
create the situation you were describing (reference being a root and object
pointed to young).

[*] Even if #become: is used since it does the equivalent of a fullGC,
implicitly tenuring the entire object space.

Cheers,
  - Andreas




More information about the Squeak-dev mailing list