[
http://issues.apache.org/jira/browse/XERCESC-1433?page=comments#action_12312974
]
Biju George commented on XERCESC-1433:
--------------------------------------
Thanks a lot. When I added following release statements (both are required) it
worked fine.
XMLString::release(&xXml);
XMLString::release(&pChar);
Delete of the variables did not work and hence I though the leak is within the
writeToString method.
> Memory leak with WriteToString
> ------------------------------
>
> Key: XERCESC-1433
> URL: http://issues.apache.org/jira/browse/XERCESC-1433
> Project: Xerces-C++
> Type: Bug
> Components: DOM
> Versions: 2.6.0
> Environment: HP-UX 11i and compiler HP ANSI C++ B3910B A.03.52
> Reporter: Biju George
>
> Using a simple serializeDOM function and in long run shows memory leak
> XERCES_CPP_NAMESPACE_USE
> int serializeDOM(DOMImplementation *impl, DOMNode* node, char * strError,
> char * outString) {
> DOMWriter* theSerializer =
> ((DOMImplementationLS*)impl)->createDOMWriter();
> try
> {
> XMLCh *xXml = theSerializer->writeToString(*node);
> char *pChar = XMLString::transcode(xXml);
> strcpy(outString,pChar);
> }
> catch (const XMLException& toCatch) {
> char* message = XMLString::transcode(toCatch.getMessage());
> strError = message;
> XMLString::release(&message);
> return FAILURE;
> }
> catch (const DOMException& toCatch) {
> char* message = XMLString::transcode(toCatch.msg);
> strError = message;
> XMLString::release(&message);
> return FAILURE;
> }
> catch (...) {
> strcpy(strError, "Unexpected Exception\n");
> return FAILURE;
> }
> theSerializer->release();
> return 0;
> }
> Commenting out the line XMLCh *xXml =
> theSerializer->writeToString(*node); will show that there is no memory leak.
> So I think the writeString method has the leak. Let me know whether I am
> doing something wrong or a fix for the same is available. I am using
> XERCESC++ version 2.6.0. Deleting xXml also did not work out for me.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]