Last post Dec 02, 2010 09:14 AM by Martin_Honnen
Dec 02, 2010 04:27 AM|ferretneck|LINK
I have a webservice with a function (code below) which seems to be suffering from memory issues. When posting XML to the WS and using the function name as the SOAP action, the w3wp.exe memory creeps up and up and up until the app pool memory limit is reached
and the app pool recycles. This is causing several timeout errors per minute on my high traffic popular sandwich website.
Can anyone tell from my code why this is happening? I have googled XMLDocument to see if there is any way of disposing back to memory, but all the responses I have found say that there is no need.
I have tried running the function with no code in at all (to see if the memory leak is elsewhere) but this used little or no memory at all. I also removed all but the first oXML.Load and the memory issue reappeared.
Thanks for your help
Dec 02, 2010 09:14 AM|Martin_Honnen|LINK
Your code sample is poorly formatted and therefore hard to read (that might not be your mistake but a forum problem) but you seem to do a lot of string operations and concatenations that are more likely to result in memory problems than a clean use of XmlDocument.
Doing string operations to perform XML manipulations is certainly not the right way, use the
XML APIs where you can create, add and remove nodes. If you really think you need to manipuate strings than at least use a
StringBuilder instead of string concatenation.