Why does it work in Managed C++ code then?

-----Original Message-----
From: Murphy, James [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 20, 2002 12:14 PM
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] strange behaviour with Garbage Collector


I think the RCW that implements a finalizer would be moved from whatever
generation it was in (probably 0) into the freachable queue on the call
to GC.Collect.  Though you have no outstanding references to the RCW one
does
exist in the freachable queue so the GC cannot collect it yet.   The RCW
will have its finalizer called on a background thread and the freachable
queue entry will be removed.  At this point the original object is no
longer reachable so its garbage and will be cleaned up at the next GC.
That's why it takes 2 GC to collect finalizable types.

Jim

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to