save the XML string or the XmlDocument object in session?

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?
 
R

Rick Strahl [MVP]

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top