[Mono-dev] GC.Collect() CLR<>Mono difference.

BGB cr88192 at hotmail.com
Thu Jan 8 15:05:45 EST 2009


----- Original Message ----- 
From: "Sunny" <sloncho at gmail.com>
To: <mono-devel-list at lists.ximian.com>
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 <sloncho at gmail.com> wrote:
>>
>> According to this:
>> <http://msdn.microsoft.com/en-us/library/system.weakreference(VS.80).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...


>
> -- 
> Svetoslav Milenov (Sunny)
>
> Even the most advanced equipment in the hands of the ignorant is just
> a pile of scrap.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 



More information about the Mono-devel-list mailing list