Hi,
I am using xerces C++ 3.1.0.
I have the following code that is causing a memory leak. I have looked
through previous posts regarding xmlToString, and the seem to say that
calling 'release()' on the Serializer fixes the memory leak.
Can anyone point out what I am doing incorrectly here? when I remove the
line of code containing writeToString, the leak disappears (but obviously I
am not getting my string!!)
//pDoc is a class member, and converToString is a class method
std::string convertToString(void)
{
// Factory method for getting a DOMImplementation object.
// The DOM implementation retains ownership of the returned object.
// Application code should NOT delete it.
DOMImplementation* impl = DOMImplementation::getImplementation();
// get a serializer, an instance of DOMLSSerializer
DOMLSSerializer *theSerializer =
((DOMImplementationLS*)impl)->createLSSerializer();
XMLCh* toTranscode= theSerializer->writeToString(pDoc);
std::string transcodedStr =
std::string(XMLString::transcode(toTranscode));
theSerializer->release();
return transcodedStr;
}
Thanks
--
View this message in context:
http://old.nabble.com/xmlToString-memory-Leak-tp27720774p27720774.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.