Some more information:

We are importing into out document , the getDocument() ( is our local function 
) in getDocument()->importNode returns our document into which we are importing 
, 
adopting the parser's document  and releasing it does not help either.

> From: [EMAIL PROTECTED]
> To: [email protected]
> Subject: Is there a memory leak on solaris DOMDocument::importNode ?
> Date: Sun, 9 Mar 2008 13:31:46 -0500
> 
> 
> This implementation (code below )  leaks memory on solaris with xerces 2.7 
> and also xerces 2.8  , does anyone see a problem with it ... if we remove the 
> DOMDocument importNode
> call it stops leaking ..We are especialy interested in fixing this with 
> xerces 2.7
> 
> 
> All help is appreciated .
> 
> Thanks
> -Anurag
> 
>    string xml = <some large xml>;// around 200 KB
>     DOMNode* returnNode = NULL;
>     DOMNode* newNode = NULL;
>     XMLCh id[7];
>     try{
>         string idString="xmlDoc";
> 
>         XMLString::transcode((const char*)idString.c_str(),id,6);
>         MemBufInputSource* mbis = new (XMLPlatformUtils::fgMemoryManager) 
> MemBufInputSource  ( (const XMLByte*)xml.c_str(),
>                                 (unsigned int)xml.length(),
>                                 id,
>                                 false,XMLPlatformUtils::fgMemoryManager );
>         mbis->setCopyBufToStream(false);
>         //xercesc::XercesDOMParser * parser= new xercesc::XercesDOMParser;
>         XercesDOMParser *parser = new (XMLPlatformUtils::fgMemoryManager) 
> XercesDOMParser(0,XMLPlatformUtils::fgMemoryManager);
> 
>         parser->parse( *mbis );
>         newNode = parser->getDocument()->getDocumentElement();
>         if(!newNode){
>             delete mbis;
>             delete parser;
>             throw FrmError(xml.c_str(),"Can not parse DOM node","",ERR_MARK);
>         }
> 
>         returnNode = getDocument()->importNode( newNode, true );
>         parser->resetDocumentPool();
>         delete mbis;
>         delete parser;
>     }catch(SAXException e){
>         void* msg = 
> XMLString::transcode(e.getMessage(),XMLPlatformUtils::fgMemoryManager);
>         string error=(char*)msg;
>         XMLString::release((void**)&msg,XMLPlatformUtils::fgMemoryManager);
>         throw FrmError(error,"","",ERR_MARK);
>     }catch(DOMException e){
>         void* msg = 
> XMLString::transcode(e.msg,XMLPlatformUtils::fgMemoryManager);
>         string error=(char*)msg;
>         XMLString::release((void**)&msg,XMLPlatformUtils::fgMemoryManager);
>         throw FrmError(error,"","",ERR_MARK);
>     }
>     if(!returnNode){
>         //throw FrmError("Can not allocate DOM Node","","",ERR_MARK);
>     }
>     return (returnNode);
> 
> 
> _________________________________________________________________
> Need to know the score, the latest news, or you need your Hotmail®-get your 
> "fix".
> http://www.msnmobilefix.com/Default.aspx

_________________________________________________________________
Climb to the top of the charts! Play the word scramble challenge with star 
power.
http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan

Reply via email to