Thank you Dave for your help. The problem is fixed now.
RWCString is the RogueWave String class.
http://www.roguewave.com/support/docs/sourcepro/edition8/html/toolsref/rwcstring.html
--
Hichem
David Bertoni wrote:
>
> hichem wrote:
>> I am having a memory leak with the following code. I am using xerce 2.7.
>> I am getting a memory leak proportionate to the size of document been
>> serialized. Please let me know if I am dong something wrong. RWCString
>> XMLHelper::serializeDocument(DOMDocument *doc) { DOMWriter* writer = 0;
>> XMLCh* result = 0; XMLPlatformUtils::Initialize(); if (!doc) return
>> RWCString(); *writer =
>> ((DOMImplementationLS*)m_impl)->createDOMWriter(); result =
>> writer->writeToString(*(DOMNode*)doc->getDocumentElement()); RWCString
>> tempStr = XMLString::transcode(result);* XMLString::release(&result);
>> writer->release(); XMLPlatformUtils::Terminate(); return result; } }
>
> It's probably the result of the call to XMLString::transcode(result),
> although it's hard to say, since I don't know what "RWCString" is.
>
> try:
> char* buf = XMLString::transcode(result);
> RWCString tempStr(buf);
> XMLString::release(&buf);
>
> Also, it seems very broken that you free "result" then return that.
> Perhaps you mean "return tempStr;" instead?
>
> Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/memroy-leak-tf3411440.html#a9553944
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]