System.Mem.Weak semantics question

Andrei Paskevich andrei at
Tue Mar 1 12:22:25 CET 2011


The documentation page on System.Mem.Weak [1] contains the following
sentence: "The finalizer, and the relationship between the key and the
value, exist regardless of whether the program keeps a reference to
the Weak object or not." Our reading of this statement implies, in
particular, that,
- given a key k, a value v, and a weak pointer w <- mkWeak k v Nothing,
- if we lose all references to v and w,
- then the value v will not be garbage-collected as long as we keep a
reference to k, even though we cannot possibly retrieve v from k only.
Is our understanding correct?

Thanks in advance and best regards,
Andrei Paskevich


More information about the Libraries mailing list