Hi Axel,
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.
Thanks again
Biju
-----Original Message-----
From: Axel Weiss (JIRA) [mailto:[EMAIL PROTECTED]
Sent: 07 June 2005 19:43
To: [EMAIL PROTECTED]
Subject: [jira] Commented: (XERCESC-1433) Memory leak with WriteToString
[
http://issues.apache.org/jira/browse/XERCESC-1433?page=comments#action_1
2312866 ]
Axel Weiss commented on XERCESC-1433:
-------------------------------------
Hi Biju,
I guess you forgot to release the transcoded string (which is your
variable pChar). So your routine itself leaks. Then, you can't make any
statement about the behaviour of DOMWriter::writeToString().
Cheers,
Axel
> 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]