XmlDocument.Close ???

  • Thread starter Thread starter kids_pro
  • Start date Start date
K

kids_pro

Hi there,

I can not find Close method of XMLDocument object.
How long will it stay in the memory after it created.

How can I make sure that it not in the XmlDocument object I create no long
exist?
Will dipose or = null help?

Cheers,
kids
 
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.
 
Peter Rilling said:
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.
 
Back
Top