[quoted text, click to view] "Michael Frost" <frostbox@hotmail.com> wrote in message
news:341571de.0408232025.5b66ed05@posting.google.com...
> The system.xml.xmldocument does not implement a method to dispose() or
> otherwise free the memory after instantiation.
The XMLDocument does not utilize unmanaged resources. While a Dispose() to
mark might be nice, it would really yield no benefit, as the GC is not going
to automagically clean it up any faster just because it is marked. The
primary reason for marking is to clean up the unmanaged resources.
[quoted text, click to view] > Another discussion thread concludes that everything is handled
> automatically though garbage collection once memory runs out !! (this
> can't be efficient?)
Jeffrey Richter has written a treatise on this. There were different types
of garbage collection schemes examined. While memory only seemed like a bad
scheme, in human thought patterns, it turned out to be the most efficient.
Having memory full is not a real issue, esp. if .NET is running on a .NET
server (ie, you are not also using it as SQL Server, a Domain Controlller
and your Exchange box). Even in these instances, the GC can sense when other
items are grabbing memory and run the GC. Whether the memory is full of junk
or not is inconsequential if you do not need. Since GC clears when you do,
it is still not a problem.
[quoted text, click to view] > Why then does other system objects implement dispose() ?? (like
> system.drawing.image)
There is an underlying hook into the unmanaged world through the windows
graphical subsystem. As long as the object itself touches the COM world
(windows API in many cases), Dispose() is necessary. Same with objects like
database connections.
[quoted text, click to view] > Is there a way to forcefully free the memory used by an xmldocument
> object ??
Only by taking control of the GC, and even that is sporadic. I doubt you can
control memory management any better, so it is more likely you will mess
this up to make your counters look better.
[quoted text, click to view] > In he old days of ASP/MSXML2 one would always free mem using :
> xml_obj = Nothing
You can null out the object in .NET, but that still will not make the GC
work any faster.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
************************************************
Think Outside the Box!
************************************************