Progressive Slow Down using XmlDocument

I am writting an application that communicates with another local application through xml using TCP/IP.

There is steady communication, and one application acts as a server sending and receiving contant results to and from the main interface. After a while simple methods invoked on an XmlDocument object take longer and longer. I was origrinally using one member XmlDocument in the class that was doing the work, so I changed it to use localized XmlDocument's inside each function of the class, and the progressive slow down persists.

I have mapped the time it takes for specific lines of code and it grows at an exponential order. One line of code that does this is:

p_obj_XmlDoc.LoadXml( "somexml string here");

Any ideas of what could be causing this?

[862 byte] By [bklare] at [2007-12-25]
# 1
Are you holding on to any of the XmlNodes in that document? If you do, this keeps the entire document alive. The other possibility is if you are holding on to the XmlNameTable, AND, the documents have random element names which is the degenerate case for the NameTable, causing it to grow unbounded.
ChrisLovett at 2007-8-31 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 2
That is a good suggestion, I will look into that and post back what I notice.

Thanks!

bklare at 2007-8-31 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 3
Chris ( or anyone else),

Could you specify what you mean by holding the XmlNodes? I will create XmlNodes that are simple inserted into the XmlDocument. The nodes are of function level scope, as is the XmlDocument, which has me believe they exist on the stack and not the heap, which, if true, should have them destroyed apon exiting the functions. I will also call .RemoveAll() on the XmlDoc before using it again.

These objects are not of the IDisposable interface either, so I do not know any other way to deallocate.

One thing that might be causing them to be "held" is that when the XmlDoc is populated, I .Save() it to a network stream.

After making some changes, the progressive slow down continues, though.

Any ideas?

bklare at 2007-8-31 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 4

Hello,

Sorry for the delay. It sounds like you may provide a simple repro for this issue. Please send it to me at the address specified here: http://antosha.com/workemail.gif. If you are sure it is a bug, you may report it through http://connect.microsoft.com/, Visual Studio and .NET Framework Feedback, and attach your code there. Thank you for reporting the issue.

Thanks,
Anton

-AntonLapounov at 2007-8-31 > top of Msdn Tech,.NET Development,XML and the .NET Framework...
# 5
Thank you for your response. I revisted the issue this morning and noticed something I failed to notice before: another line that is slowing down is when I read a byte from the network stream. It is only the first byte of each reading instance that slows down. Each succesive byte read from a stream of incomming data is quick and at a constant speed. I am going to repost this in a more appropriate forum. There still might be an issue with the XmlDocument, so I will refresh this thread if so. I will also send you a repro if the problem does not become resolved.

The link to my new thread is:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=797070&SiteID=1

v/r,
Brendan

bklare at 2007-8-31 > top of Msdn Tech,.NET Development,XML and the .NET Framework...

.NET Development

Site Classified