[Mono-dev] GC.Collect() CLR<>Mono difference.
Robert Jordan
robertj at gmx.net
Thu Jan 8 13:20:15 EST 2009
Sunny wrote:
> 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.
This is not a bug. The sample is too primitive to trigger a GC
collection. Just add some complexity, e.g. a for-loop which generates
a lot of those WeakReferences.
Robert
More information about the Mono-devel-list
mailing list