Can you try running with validation turned off and without setting your
custom error handler?
Alberto
Abhinav Kishore Srivastava wrote:
Dear David Bertoni,
Thanks for the suggestion. I removed the 'new' call from my code and created the object of membuf and XercesDOMParser as you suggested but still there is a memory leak. After the analysis of the process log I saw that the memory leak is happening when I am calling "m_domParser->parse(membuf);". I guess the memory allocated while parsing is not getting released.
Can you suggest me the different ways to release the memory allocated with
parsing? To be of safer side I am calling the following after the 'parse'
function -
DOMDocument* m_doc;
m_doc = m_domParser->adoptDocument();
if (m_domParser!=0)
{
m_domParser = 0;
}
if(m_doc!=0)
{
m_doc->release();
delete m_doc;
m_doc = 0;
}
But this is not helping at all and memory is leaking like it used to be earlier.
Thanks,
Abhinav Kishore
-----Original Message-----
From: David Bertoni [mailto:[email protected]]
Sent: Wednesday, June 17, 2009 11:19 PM
To: [email protected]
Subject: Re: Regd issue : Memory leak in 'Parse' function of DOMParser
Abhinav Kishore Srivastava wrote:
Hi,
Does that mean I don't have to create the parser and membuf objet with 'new'??
If not then how should I create it? In my application the same process receives
request for xml parsing at different times. Each time I am creating a new
object of parser and then deleting it too.
You can create them on the stack:
MemBufInputSource membuf(
(const XMLByte*)theString.data(),
theString.size(),
"APIXMLInterface",
false);
XercesDOMParser localParser;
m_domParser = &localParser;
...
m_domParser = 0;
Although I don't know if that will help much, since the parser will
allocate memory dynamically regardless.
Also, I checked my process giving it a bad input. In that case the process gets core dump releasing all the memory acquired.
Why does your application core dump on bad input? The parser shouldn't
do that.
None of your evidence proves the Xerces-C library is leaking memory. I
suggest you test the parser code outside of your application to verify
if there is a memory leak.
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are not
to copy, disclose, or distribute this e-mail or its contents to any other person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
every reasonable precaution to minimize this risk, but is not liable for any damage
you may sustain as a result of any virus in this e-mail. You should carry out your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]