save the XML string or the XmlDocument object in session?

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I'm wondering how much more memory an XmlDocument object takes than the
corresponding Xml string? I have some user data to store in ASP.NET session
and everytime it's used, an XmlDocument object is needed. If there's not
too much difference in the memory consumption, then saving the object would
make more sense than just saving the string.

On a side note, is there a way to find out the memory usage of a variable at
runtime? Does VS.NET debugging capability somehow do this?
 
Well, the DOM will take up some space for sure as the XML document is
represented as a binary tree in the object. The behavior will actually vary
depending on whether you're using an InProc session or one of the serialized
mechanism like State or Sql Server in which case the XMLDocument will
serialize into an XML stream anyway.

I'm not sure to be honest how much difference in perf there will be, but it
should be easy to test with a few simple timing tests that write and read
data into Session.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
 
Back
Top