Thanks for the fast answer.

The code was an attempt to isolate a memory leak, but I add the extra error 
that you have pointed out, so my test were wrong.

However I found my real problem, and my lack od memory were caused by the 
missing deletion of XercesDomParser object.

In a procedure A I buld a DOMDOcument from a XercesDOMParser->getDocmennt().
Then in other procedures I use the DOMDocument object and then I release it but 
I didn't delete the XercesDomParser object.

It is not enough release only DOMDocuemnt to release also XercesDOMParser , is 
this right ?

Now I keep track also of the XercesDOMParser obejct and I delete it, and I have 
no more memory leak.

By the way, if I have a DOMDOcument object create using 
XercesDOMParser->getDocmennt(), is there a DOMDocument obejct which return me a 
reference to the original XercesDOMParser object ?

reagrds, Enzo


-----Messaggio originale-----
Da: Alberto Massari [mailto:[email protected]]
Inviato: giovedì 8 gennaio 2009 11.11
A: [email protected]
Oggetto: Re: R: parse memory leak


Hi Enzo,
every parsed file is stored in a cache (unless you invoke adoptDocument 
to decide to own its lifetime by yourself); the cache is emptied when 
you call release() on the parser object. Your code doesn't release 
neither the parser or the error handler; try printing the memory 
allocated after you delete both objects.

Alberto

Enzo Arlati wrote:
>  
> I have xerces 2.7 on a redhat 7.3 and I have a memory leak of about 12 
> k when I run the parse() method of XercesDOMParser .
> Belowe I copy the code involved.
> Is there an error in the code or is this a bug ? 
>  
>  
> /*****************************************************************************************/
> int
> util_xerces::BuildDomParser( XercesDOMParser ** domParser )
> {
>   int       iret;
>  
>   ( *domParser ) = new XercesDOMParser;
>   ( *domParser )->setValidationScheme( XercesDOMParser::Val_Auto );
>   ( *domParser )->setDoNamespaces( false );
>   ( *domParser )->setDoSchema( false );
>   ( *domParser )->setValidationSchemaFullChecking( false );
>   ( *domParser )->setCreateEntityReferenceNodes( true );
>  
>   iret = IRET_OK;
>   return iret;
>  
> }     // _________  void util_xerces::BuildDomParser( )
>  
> /*****************************************************************************************/
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to