<matt_felzani@yahoo.com> wrote:[color=blue]
> that's what i was thinking, but a bit back i read this article on
> theserverside.net:
>
>
http://www.theserverside.net/article...bageCollection
>
> which confused me as they say that it was the usage of GC.KeepAlive()
> in a using block which solved their bug. however, could have been more
> of a outlier-type scenario? they talk about having a 'proxy' as well
> which is probably the root of the problem (not that the proxy *is* the
> problem, per sa, but rather just part of the complicated equation) in
> that the proxy and the 'real' object are disposed of as separate
> entities as opposed to an atomic instance.[/color]
I strongly suspect that GC.KeepAlive wasn't actually what solved the
problem for them. It wouldn't be the first time I've seen someone apply
two changes at once and declare them both necessary, without having
tested each separately.
There are oddities with garbage collection to be sure, but none that
would do that, IMO.
Interestingly, they *do* have a bug in their Dispose implementation.
They set inst to 0 and don't use it any further in the method, but
that's *before* they call GC.SuppressFinalize. I suspect they may have
seen finalization taking place between the call to Interlocked.Exchange
and the call to SuppressFinalize, which would have caused them some
grief...
Anyway, I'd want to see clear evidence of the finalizer being called
within the using block before believing it.
[color=blue]
> great catch on IDisposable. that was just silly on my part. oh well,
> i'm past it now.[/color]
:)
--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too