I have no particular reason to think that b) would gain me anything, but I thought maybe it would be a sure sign to the garbage
collector that Yes, you can go ahead and remove the object.
Thanks!
--
Adam Clauss
cab...@tamu.edu
Yes - explicitly setting it to null might take slightly longer, if the
JIT doesn't notice that the write is useless.
Actually, when running under a debugger there'll be a difference in
that the object (assuming there are no other references to it) will be
eligible for garbage collection from the point at which the variable is
set to null, compared with having to actually wait for it to go out of
scope. In release mode, it doesn't even have to wait to go out of scope
or be set to null - after the last use of it, the GC won't treat it as
a live reference.
> I have no particular reason to think that b) would gain me anything,
> but I thought maybe it would be a sure sign to the garbage
> collector that Yes, you can go ahead and remove the object.
Nope.
--
Jon Skeet - <sk...@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
--
Adam Clauss
cab...@tamu.edu
"Jon Skeet [C# MVP]" <sk...@pobox.com> wrote in message news:MPG.1b4508636...@msnews.microsoft.com...