[prev in list] [next in list] [prev in thread] [next in thread]
List: xerces-c-dev
Subject: Possible memory leak in parser xercersc 2.7.0?
From: Reinhard Schneeberger <reani.schnee () gmail ! com>
Date: 2009-03-03 20:38:14
Message-ID: f518bd6c0903031238t16654f41l1a1dc7760954e6db () mail ! gmail ! com
[Download RAW message or body]
Hi,
I'm using xercesc 2.7.0 on a AIX 5.2 box and I'm wondering if the parse
function has a memory leak. Below you can see the function I'm using -
returns DOMDocument*
XMLPlatformUtils::Initialize() is called in the constructor and
XMLPlatformUtils::Terminate() in the destructor of the class.
Also, I stepped through the code and the only increase in memory I can see
is when calling the parse function. I release the parser delete all objects,
but still no luck.
All suggestions are appreciated.
Thanks
Richard
------------------------------
------------------------------------------------------------------------
DOMBuilder * parser = NULL;
DOMImplementation * impl =
DOMImplementationRegistry::getDOMImplementation(tmpStr);
parser = impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS,
NULL);
parser->setFeature(XMLUni::fgDOMNamespaces, true);
parser->setFeature(XMLUni::fgDOMValidation, true);
parser->setErrorHandler(errHdl);
parser->setEntityResolver(entRes);
parser->resetDocumentPool();
errHdl->resetErrors();
DOMDocument* xmlDoc;
MemBufInputSource* memBufIS = new MemBufInputSource((const unsigned char
*const) pStr, strlen(pStr), bufID);
DOMInputSource * inSource = new Wrapper4InputSource(memBufIS);
xmlDoc = parser->parse(*inSource);
delete inSource;
if( errHdl->getHasErrors() )
{
parser->release();
return errHdl->getExceptionDOMDocument();
}
else
{
parser->resetDocumentPool();
parser->resetCachedGrammarPool();
parser->release();
delete parser;
delete entRes;
delete errHdl;
return xmlDoc;
}
------------------------------------------------------------------------------------------------------
[Attachment #3 (text/html)]
Hi,<br><br>I'm using xercesc 2.7.0 on a AIX 5.2 box and I'm wondering
if the parse function has a memory leak. Below you can see the function
I'm using - returns DOMDocument*<br>XMLPlatformUtils::Initialize() is called in \
the constructor and XMLPlatformUtils::Terminate() in the destructor of the class.<br>
<br>Also,
I stepped through the code and the only increase in memory I can see is
when calling the parse function. I release the parser delete all
objects, but still no luck.<br><br><br>All suggestions are appreciated.<br>
<br>Thanks<br>Richard<br><br><br>------------------------------<div>------------------------------------------------------------------------<br>DOMBuilder \
* parser = NULL;<br>DOMImplementation * impl = \
DOMImplementationRegistry::getDOMImplementation(tmpStr);<br>
parser = impl->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, \
NULL);<br><br>parser->setFeature(XMLUni::fgDOMNamespaces, \
true);<br>parser->setFeature(XMLUni::fgDOMValidation, \
true);<br><br><br>parser->setErrorHandler(errHdl);<br>
parser->setEntityResolver(entRes);<br>parser->resetDocumentPool();<br>errHdl->resetErrors();<br><br>DOMDocument* \
xmlDoc;<br><br>MemBufInputSource* memBufIS = new MemBufInputSource((const unsigned \
char *const) pStr, strlen(pStr), bufID);<br>
<br>DOMInputSource * inSource = new Wrapper4InputSource(memBufIS);<br><br>xmlDoc = \
parser->parse(*inSource);<br><br>delete inSource;<br><br><br>if( \
errHdl->getHasErrors() )<br>{<br> parser->release();<br> return \
errHdl->getExceptionDOMDocument();<br>
}<br>else<br>{<br> parser->resetDocumentPool();<br> \
parser->resetCachedGrammarPool();<br> parser->release();<br><br> delete \
parser;<br> delete entRes;<br> delete errHdl;<br><br> return xmlDoc;<br>
} <br>------------------------------------------------------------------------------------------------------
</div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic