[Mono-list] Anyone working on System.WeakReference?

Miguel de Icaza miguel@ximian.com
18 Nov 2001 03:00:16 -0500


On Sun, 2001-11-18 at 01:02, Daniel Weber wrote:
> I'm interested in using weak references in the Xml DOM implementation for 
> owner node type references.  Since the DOM tree contiains pointers to 
> children, and the children contain references to the tree, I end up with a 
> circular reference, which may prevent GC when the tree is released.

It wont prevent GC when the tree is released.  The GC system traces from
the roots.  If there is no reference from the roots to the tree or the
nodes, even if those have cycles they will be disposed.

> I didn't see anyone in the class maintainers, but weak references seem like 
> they'll need some special support.

Yes, weak references do need special support.  But I dont think that
they are needed here.

Miguel.