Re: Weak references and unmanaged pointers...

Fergus Henderson <[email protected]> Wed, 23 Jul 2003 18:58:23 +1000
Newsgroups gmane.comp.gnome.mono.garbage-collection
Message-ID <[email protected]>
On 23-Jul-2003, Fernando Diaz <[email protected]> wrote:
> I hava another question for the list.
> Are the unmaganed pointers (that mentions the ECMA-335 standard) the
> same as the weak references (that exists in the .NET garbage collector)?

No. 

Unmanaged pointers must not point into the managed heap.
They are ignored by the garbage collector.

Weak references, on the other hand, do point into the managed heap,
and will get updated by the collector if the object that they point to
gets relocated.

The difference between weak references and ordinary (managed) references
is that weak references will not keep an object alive; if the only
references to an object are weak references, the collector will reclaim
the object and will set the weak references to null.

-- 
Fergus Henderson <[email protected]>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
_______________________________________________
Mono-gc-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-gc-list