On Thu, Jan 8, 2009 at 6:05 PM, BGB <[email protected]> wrote:
> > ----- Original Message ----- > From: "Sunny" <[email protected]> > To: <[email protected]> > Sent: Friday, January 09, 2009 3:50 AM > Subject: Re: [Mono-dev] GC.Collect() CLR<>Mono difference. > > > > On Thu, Jan 8, 2009 at 11:45 AM, Sunny <[email protected]> wrote: > >> > >> According to this: > >> < > http://msdn.microsoft.com/en-us/library/system.weakreference(VS.80).aspx<http://msdn.microsoft.com/en-us/library/system.weakreference%28VS.80%29.aspx> > > > >> > >> IsAlive becomes false after the finalizer is done. It may be so, that > >> under mono your call to IsAlive is made before the finalizer is > >> called. Try with GC.WaitForPendingFinalizers() before the check. > >> > > > > Hmmm, I just tried it under mono, it still outputs True. Looks like a > bug. > > > > possible factor: > references to 'obj' still exist, and are lingering on the stack, ... > > so, with a precise GC, the only reference which can exist is the weak > reference; > but with a conservative GC (such as Boehm), any lingering references are > still good. > > (note: it appears to me like the project is implementing / has implemented > an optional precise GC, but I don't know the status, ...). > > > so, the GC runs, and maybe it finds a reference still on the stack > somewhere?... > ok then, the object is not collected, and thus no need for the weak ref to > report a change... > > > I could be wrong though... > > You are correct, this is exactly what happens on this case. The object still reachable to the conservative GC mono uses. Our precise GC is still in development.
_______________________________________________ Mono-devel-list mailing list [email protected] http://lists.ximian.com/mailman/listinfo/mono-devel-list
