Peter Rilling <pe***@nospam.rilling.net> wrote:
Sure. Once loaded from the stream, it is no longer bound to the content.
It is entirely in memory and simply setting it to null should work. Let
garbage collection handle it after that.
Note that, as with anything else, you usually don't have to set a
variable's value to null. If it's a local variable and isn't used later
in the method, the JIT can tell that and won't use it as a GC root. If
it's a member variable, my experience is that in well-designed classes
the member variable's value is usually no longer needed at exactly the
point that the enclosing instance itself is no longer needed - so that
won't be a problem either. If it's a static variable, you may want to
set it to null - but personally I can't remember the last time I had a
static variable which was only useful for a while.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too