You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by radada <pa...@yahoo.fr> on 2009/05/15 16:16:49 UTC

Core Dump while releasing Parser ressources...

Hi there : )

I think I'm going nuts : (
Thanks to Alberto, I've got a code which is approximatively good. As told in
a previous post, I implemented a functional layer over the xerces library so
that we can use it in our software at work.
In order to control as much as possible the memory leaks, I created a
singleton which can (and only it can) create DOMDocument and
XercesDOMParser. It is reponsible too for the releasing of the objets.

So for the parser, I've got a release method : 

void XMLFactory::releaseParser(ParserXML* p_poParser)
{  
   #ifdef AFF
      cout << "XMLFactory::releaseParser()" << endl;
   #endif


   // suppression en se basant sur les adresses des objets
   for (int i=0; i<m_oListeParserXML.entries(); i++)
   {
      ParserXML* ptr = NULL;
      ptr = m_oListeParserXML.at(i);
      if (ptr == p_poParser)
         m_oListeParserXML.removeAt(i);
   }
      
   // on delete l'objet (on test avant s'il n'est pas NULL avec le
ThrowIfNullWithMsg)
   DeleteIfObject(p_poParser);
}

In the destructor of the Parser, I've got this : 

ParserXML::~ParserXML()
{   
   #ifdef AFF
      cout << "Destructeur de ParserXML" << endl;
   #endif
   
   if (m_poDocument != NULL)
   {
      m_poDocument->release();
   }
   m_poDOMParser->reset();

   DeleteIfObject(m_poDOMParser);
   DeleteIfObject(m_poErrorHandler);
   DeleteIfObject(m_poDOMDocument);
   DeleteIfObject(m_poElementXML);
}

Some strange things happen, especially when I compare my code to the DOM
Programming Guide Chapter "Constructing a XercesDOMParser"
(http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that, to
delete a parser and its ressources, one only have to delete the parser.
If I do that, I get a core Dump while deleting the DOMDocument.
So I added a m_poDOMParser->resetDocumentPool(), but it had the same effect.
Then I tried with m_poDOMParser->reset() and it did work! Well, not that
much. Sometimes it does, sometimes it doesn't. I still get a core Dump
sometimes, always when deleting the parser...

Just for the record, here is the parsing method : 

 ElementXML* ParserXML::parse(const char* p_pcBuffer)
{
   #ifdef AFF
      cout << "ParserXML::parse()" << endl;
   #endif
      
   // Si aucun buffer n'est passé, on renvoie NULL
   if (p_pcBuffer == NULL)
   {
      return NULL;
   }
   
   // si le parser n'a pas libéré les ressources du précédent parse   
   if (m_bDocumentParsed)
   {
      if (m_poDocument != NULL)
      {
         m_poDocument->release();
      }
      m_poDOMParser->reset();
      m_bDocumentParsed = false;
   }
   
   char* l_pcMessage;
   // on crée un objet pour le parsing
   MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
                                    strlen(p_pcBuffer),
                                    (const XMLCh*)  "ParserXML");
   try
   {
      // on parse
      m_poDOMParser->parse(l_oInputSource);
      
      // on récupère le DOMDocument parsé
      m_poDocument = m_poDOMParser->getDocument();
      
      // on libère la mémoire si besoin
      DeleteIfObject(m_poElementXML);
      //on crée un nouveau ElementXML avec les données du DOMDocument
      m_poElementXML = new ElementXML(m_poDocument->getDocumentElement());
      // on indique que le Document a été correctement parsé
      m_bDocumentParsed = true;
      // on retourne l'ElementXML ainsi créé
      return m_poElementXML;
   }
   catch(XMLException& XMLEx)
   {
      l_pcMessage = XMLString::transcode(XMLEx.getMessage());
      ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(DOMException& DOMEx)
   {
      l_pcMessage = XMLString::transcode(DOMEx.msg);
      ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(SAXParseException& SaxParseEx)
   {
      l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
      ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(SAXException& SaxEx)
   {
      l_pcMessage = XMLString::transcode(SaxEx.getMessage());
      ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(...)
   {
      ExceptMessage ex("T00450", " ", "Erreur inconnue");
      ex.doThrow();
   }
}

You just can't imagine how happy will I be when I won't have to code into
this libraby :D
Anyway, as always, if you find something weird, or even the tinniest clue,
please, post here.

Thanks a lot.

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23560721.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by David Bertoni <db...@apache.org>.
radada wrote:
> Hi and thanks four your answer.
> The ElementXML is a class from scratch that only contains a pointer to a
> DOMNode element. It's only here to redefine some methods to access the
> Elements inside a DOMNode.
> Didn't knew about valgring. I compile on AIX so I'll give it a try.
Valgrind only runs on x86 hardware, so you cannot use it.

> 
> The weirdest thing happened : my program is a short of demon. It runs
> "forever" and treats the files I put in a folder (to sum up). When I give it
> 3000 files, I get a core dump with the memory growing up to 120 Mo not
> released.
> If I use 300 files, the memory goes up to 35 Mo. If I put 600 files, it
> grows to 55 Mo. But, if I put 300 files, let the program roll and put again
> 300 files, I see the memory growing up to 35 Mo the first time, and when I
> put the next 300, the memory is still at 35 Mo, but it doesn't grow anymore.
> nos, if I place 300 files, and then 600, the memory grows up for the first
> 300, then stays still for the next 300 and then starts growing again for the
> last 300. 
> 
> It acts like when it processes files continuously, it can't free the memory.
> But if I "let it breath" and give it some more files, the memory is somehow
> "reused" for the same amount of memory...
> 
> Does anybody have any idea where this behavior can come from??
Yes.  It sounds like this is the AIX C run-time heap causing this 
behavior.  There are AIX heap debug routines and environment variables 
that can help you:

http://www.redbooks.ibm.com/redbooks/pdfs/sg245674.pdf

Read chapter 4 for more information.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by radada <pa...@yahoo.fr>.
Hi and thanks four your answer.
The ElementXML is a class from scratch that only contains a pointer to a
DOMNode element. It's only here to redefine some methods to access the
Elements inside a DOMNode.
Didn't knew about valgring. I compile on AIX so I'll give it a try.

The weirdest thing happened : my program is a short of demon. It runs
"forever" and treats the files I put in a folder (to sum up). When I give it
3000 files, I get a core dump with the memory growing up to 120 Mo not
released.
If I use 300 files, the memory goes up to 35 Mo. If I put 600 files, it
grows to 55 Mo. But, if I put 300 files, let the program roll and put again
300 files, I see the memory growing up to 35 Mo the first time, and when I
put the next 300, the memory is still at 35 Mo, but it doesn't grow anymore.
nos, if I place 300 files, and then 600, the memory grows up for the first
300, then stays still for the next 300 and then starts growing again for the
last 300. 

It acts like when it processes files continuously, it can't free the memory.
But if I "let it breath" and give it some more files, the memory is somehow
"reused" for the same amount of memory...

Does anybody have any idea where this behavior can come from??
Thanks.


David Bertoni wrote:
> 
> radada wrote:
>> Hi there
>> 
>> 
>> after searching a little bit, I found that there was some objects that
>> were
>> not deleted in the other programs.
>> But (still that damn but...) I still get a memory leak. Weird thing :
>> when I
>> delete the parser, the memory doesn't decrease. It just stays still...
>> And
>> after a couple hundreds of XML files parsed, this memory leak is getting
>> big.
>> It seems that the memory increases after calling the parse method. But
>> since
>> the deletion of the parser seems to have no effect on the memory, it
>> could
>> come from either methods.
>> 
>> Here's the code for the parse method : 
>> 
>> ElementXML* ParserXML::parse(const char* p_pcBuffer)
>> {
>>    #ifdef AFF
>>       cout << "ParserXML::parse()" << endl;
>>    #endif
>>       
>>    // Si aucun buffer n'est passé, on renvoie NULL
>>    if (p_pcBuffer == NULL)
>>    {
>>       #ifdef DEBUG
>>          cout << "Aucun Flux à Parser!!!" << endl;
>>       #endif
>>       return NULL;
>>    }
>>    
>>    char* l_pcMessage;
>>    // on crée un objet pour le parsing
>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>                                     strlen(p_pcBuffer),
>>                                     (const XMLCh*)  "ParserXML");
> You cannot cast a character string constant to a UTF-16 string.  This 
> cast is incorrect.
> 
>>    try
>>    {
>>       // on parse
>>       m_poDOMParser->parse(l_oInputSource);
>>       #ifdef DEBUG
>>          cout << "Document Parsé" << endl;
>>       #endif
>>       
>>       // on libère la mémoire si besoin
>>       delete(m_poElementXML);
>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>       m_poElementXML = new
>> ElementXML(m_poDOMParser->getDocument()->getDocumentElement());
>>       // on retourne l'ElementXML ainsi créé
>>       return m_poElementXML;
> Is ElementXML a single class, or a hierarchy of clases?  What does its 
> definition look like?
> 
> If you are building on Linux, I suggest you run your program under 
> valgrind, which will detect errors and memory leaks in your program.
> 
> If you are building on Windows, I suggest you turn on the leak detection 
> code in the C run-time library, which will give you a dump of leaks when 
> your program exits.
> 
> Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23761914.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by David Bertoni <db...@apache.org>.
radada wrote:
> Hi there
> 
> 
> after searching a little bit, I found that there was some objects that were
> not deleted in the other programs.
> But (still that damn but...) I still get a memory leak. Weird thing : when I
> delete the parser, the memory doesn't decrease. It just stays still... And
> after a couple hundreds of XML files parsed, this memory leak is getting
> big.
> It seems that the memory increases after calling the parse method. But since
> the deletion of the parser seems to have no effect on the memory, it could
> come from either methods.
> 
> Here's the code for the parse method : 
> 
> ElementXML* ParserXML::parse(const char* p_pcBuffer)
> {
>    #ifdef AFF
>       cout << "ParserXML::parse()" << endl;
>    #endif
>       
>    // Si aucun buffer n'est passé, on renvoie NULL
>    if (p_pcBuffer == NULL)
>    {
>       #ifdef DEBUG
>          cout << "Aucun Flux à Parser!!!" << endl;
>       #endif
>       return NULL;
>    }
>    
>    char* l_pcMessage;
>    // on crée un objet pour le parsing
>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>                                     strlen(p_pcBuffer),
>                                     (const XMLCh*)  "ParserXML");
You cannot cast a character string constant to a UTF-16 string.  This 
cast is incorrect.

>    try
>    {
>       // on parse
>       m_poDOMParser->parse(l_oInputSource);
>       #ifdef DEBUG
>          cout << "Document Parsé" << endl;
>       #endif
>       
>       // on libère la mémoire si besoin
>       delete(m_poElementXML);
>       //on crée un nouveau ElementXML avec les données du DOMDocument
>       m_poElementXML = new
> ElementXML(m_poDOMParser->getDocument()->getDocumentElement());
>       // on retourne l'ElementXML ainsi créé
>       return m_poElementXML;
Is ElementXML a single class, or a hierarchy of clases?  What does its 
definition look like?

If you are building on Linux, I suggest you run your program under 
valgrind, which will detect errors and memory leaks in your program.

If you are building on Windows, I suggest you turn on the leak detection 
code in the C run-time library, which will give you a dump of leaks when 
your program exits.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by radada <pa...@yahoo.fr>.
Hi there


after searching a little bit, I found that there was some objects that were
not deleted in the other programs.
But (still that damn but...) I still get a memory leak. Weird thing : when I
delete the parser, the memory doesn't decrease. It just stays still... And
after a couple hundreds of XML files parsed, this memory leak is getting
big.
It seems that the memory increases after calling the parse method. But since
the deletion of the parser seems to have no effect on the memory, it could
come from either methods.

Here's the code for the parse method : 

ElementXML* ParserXML::parse(const char* p_pcBuffer)
{
   #ifdef AFF
      cout << "ParserXML::parse()" << endl;
   #endif
      
   // Si aucun buffer n'est passé, on renvoie NULL
   if (p_pcBuffer == NULL)
   {
      #ifdef DEBUG
         cout << "Aucun Flux à Parser!!!" << endl;
      #endif
      return NULL;
   }
   
   char* l_pcMessage;
   // on crée un objet pour le parsing
   MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
                                    strlen(p_pcBuffer),
                                    (const XMLCh*)  "ParserXML");
   try
   {
      // on parse
      m_poDOMParser->parse(l_oInputSource);
      #ifdef DEBUG
         cout << "Document Parsé" << endl;
      #endif
      
      // on libère la mémoire si besoin
      delete(m_poElementXML);
      //on crée un nouveau ElementXML avec les données du DOMDocument
      m_poElementXML = new
ElementXML(m_poDOMParser->getDocument()->getDocumentElement());
      // on retourne l'ElementXML ainsi créé
      return m_poElementXML;
   }
   catch(XMLException& XMLEx)
   {
      l_pcMessage = XMLString::transcode(XMLEx.getMessage());
      ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(DOMException& DOMEx)
   {
      l_pcMessage = XMLString::transcode(DOMEx.msg);
      ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(SAXParseException& SaxParseEx)
   {
      l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
      ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(SAXException& SaxEx)
   {
      l_pcMessage = XMLString::transcode(SaxEx.getMessage());
      ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
      XMLString::release(&l_pcMessage);
      ex.doThrow();
   }
   catch(...)
   {
      ExceptMessage ex("T00450", " ", "Erreur inconnue");
      ex.doThrow();
   }
}



radada wrote:
> 
> So I actually did the right thing, but I still get that damn memory
> leak...
> I really don't understand where this could come from.
> Since you have the code, if I could abuse, do you have any clue? I mean,
> the code of the ParserXML object is pretty small, so I don't understand
> how can this lead to a memory leak.
> 
> I use the parser this way : 
> 
> ServiceMEP* ServicePRC::getServiceMiseEnPaiement(const char* p_pcFluxPRC)
> {
>    ParserXML* l_poParser = NULL;
>    ServiceMEP*  l_poService      = NULL;
>    ElementXML*  l_poElementXML   = NULL;
>    
>    try
>    {    
>       //--- Convertit le flux en UTF-8
>       DeleteIfObject(m_pcBuffer);
>       m_pcBuffer= new char[(strlen(p_pcFluxPRC)*2) + 1];
>       memset(m_pcBuffer, '\0', (strlen(p_pcFluxPRC)*2) + 1);
>       XMLFactory::convertToUTF8(p_pcFluxPRC, m_pcBuffer);
>       
>       //--- Parse le flux de données et récupération de l'ElementXML
> correspondant
>       l_poParser = m_poXMLFactory->createParser();
>       ThrowIfNullWithMsg(l_poParser, "Impossible de récupérer une instance
> de ParserXML dans getServiceMiseEnPaiement");
>       // parsing du flux proprement dit
>       l_poElementXML = l_poParser->parse(m_pcBuffer);
>       
>       if (l_poElementXML != NULL)
>          //--- Recuperation du document racine
>          l_poService = new ServiceMEP(l_poElementXML);
>       
>       #ifdef DEBUG
>          l_poService->PrintOn(cout);
>       #endif
>    
>       //--- Nettoie les elements
>       m_poXMLFactory->releaseParser(l_poParser);
>       DeleteIfObject(m_pcBuffer);
>       
>       //--- Creation des objets entites 
>       return l_poService;
>    }
> 
> and of course, I delete the ServiceMEP* after using it. The ElementXML is
> released by the parser since the Parser allocates the memory for the
> Element.
> Man I wish this was over : (
> Thanks again.
> 
> 
> Alberto Massari wrote:
>> 
>> In order to release the DOM trees owned by the parser, you either delete 
>> the parser or call resetDocumentPool(). The reset() method is simply 
>> initializing the internal variables before a parsing operation starts.
>> 
>>     /** Reset the parser
>>       *
>>       * This method resets the state of the DOM driver and makes
>>       * it ready for a fresh parse run.
>>       */
>>     void reset();
>> 
>> 
>>     /** Reset the documents vector pool and release all the associated 
>> memory
>>       * back to the system.
>>       *
>>       * When parsing a document using a DOM parser, all memory allocated
>>       * for a DOM tree is associated to the DOM document.
>>       *
>>       * If you do multiple parse using the same DOM parser instance, then
>>       * multiple DOM documents will be generated and saved in a vector
>> pool.
>>       * All these documents (and thus all the allocated memory)
>>       * won't be deleted until the parser instance is destroyed.
>>       *
>>       * If you don't need these DOM documents anymore and don't want to
>>       * destroy the DOM parser instance at this moment, then you can 
>> call this method
>>       * to reset the document vector pool and release all the allocated 
>> memory
>>       * back to the system.
>>       *
>>       * It is an error to call this method if you are in the middle of a
>>       * parse (e.g. in the mid of a progressive parse).
>>       *
>>       * @exception IOException An exception from the parser if this
>> function
>>       *            is called when a parse is in progress.
>>       *
>>       */
>>     void resetDocumentPool();
>> 
>> Alberto
>> 
>> radada ha scritto:
>>> God this library is hard to use : (
>>> So : the core dump is gone, thanks : ) (I removed the call to release
>>> and
>>> the deletion of the DOMDocument)
>>> But (there's always a but...), I get a memory leak now. This is why is
>>> used
>>> the reset() method on the parser at first I think.
>>> The only way to release a parser and its associated objects is to delete
>>> it
>>> or is there another method to call?
>>> Thanks, again : /
>>>
>>>
>>> Alberto Massari wrote:
>>>   
>>>> If you use XercesDOMParser::getDocument to retrieve the parsed 
>>>> DOMDocument, you should NOT call either DOMDocument::release or delete 
>>>> the object, as the DOM tree is owned by the parsed and will be deleted 
>>>> by him when you release it.
>>>> If you are going to keep the parser for a long time, you may want to 
>>>> handle the lifetime of the DOM tree yourself; but in that case you 
>>>> should retrieve it from the parser by using 
>>>> XercesDOMParser::adoptDocument, and you will have to use 
>>>> DOMDocument::release to free it (don't use "delete" as it will not 
>>>> perform all the cleanup, and in any case you are not assured it has
>>>> been 
>>>> created by the same "new" operator matching your "delete" operator).
>>>>
>>>> Alberto
>>>>
>>>> P.S. it is written in the documentation as well:
>>>>
>>>>     /** Get the DOM document
>>>>       *
>>>>       * This method returns the DOMDocument object representing the
>>>>       * root of the document tree. This object provides the primary
>>>>       * access to the document's data.
>>>>       *
>>>>       * The returned DOMDocument object is owned by the parser.
>>>>       *
>>>>       * @return The DOMDocument object which represents the entire
>>>>       *         XML document.
>>>>       */
>>>>     DOMDocument* getDocument();
>>>>
>>>>     /** Adopt the DOM document
>>>>       *
>>>>       * This method returns the DOMDocument object representing the
>>>>       * root of the document tree.
>>>>       *
>>>>       * The caller will adopt the DOMDocument and thus is responsible
>>>> to
>>>>       * call DOMDocument::release() to release the associated memory.
>>>>       * The parser will not delete it.   The ownership is transferred
>>>>       * from the parser to the caller.
>>>>       *
>>>>       * @return The adopted DOMDocument object which represents the
>>>> entire
>>>>       *         XML document.
>>>>       */
>>>>     DOMDocument* adoptDocument();
>>>>
>>>>
>>>>
>>>> radada ha scritto:
>>>>     
>>>>> Thanks Alberto, but I'm perplex now : should I call the release method
>>>>> on
>>>>> the
>>>>> DOMDocument ou should I just delete it w/o calling release?
>>>>> Thx man : )
>>>>>
>>>>>
>>>>> Alberto Massari wrote:
>>>>>   
>>>>>       
>>>>>> You shouldn't explicitly release a DOMDocument unless you adopted it 
>>>>>> from the DOMParser, or it will try to release it after it has already 
>>>>>> been deleted.
>>>>>> You shouldn't also attempt to delete an object that you already
>>>>>> released.
>>>>>>
>>>>>> Alberto
>>>>>>
>>>>>> radada ha scritto:
>>>>>>     
>>>>>>         
>>>>>>> Hi there : )
>>>>>>>
>>>>>>> I think I'm going nuts : (
>>>>>>> Thanks to Alberto, I've got a code which is approximatively good. As
>>>>>>> told
>>>>>>> in
>>>>>>> a previous post, I implemented a functional layer over the xerces
>>>>>>> library
>>>>>>> so
>>>>>>> that we can use it in our software at work.
>>>>>>> In order to control as much as possible the memory leaks, I created
>>>>>>> a
>>>>>>> singleton which can (and only it can) create DOMDocument and
>>>>>>> XercesDOMParser. It is reponsible too for the releasing of the
>>>>>>> objets.
>>>>>>>
>>>>>>> So for the parser, I've got a release method : 
>>>>>>>
>>>>>>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>>>>>>> {  
>>>>>>>    #ifdef AFF
>>>>>>>       cout << "XMLFactory::releaseParser()" << endl;
>>>>>>>    #endif
>>>>>>>
>>>>>>>
>>>>>>>    // suppression en se basant sur les adresses des objets
>>>>>>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>>>>>>    {
>>>>>>>       ParserXML* ptr = NULL;
>>>>>>>       ptr = m_oListeParserXML.at(i);
>>>>>>>       if (ptr == p_poParser)
>>>>>>>          m_oListeParserXML.removeAt(i);
>>>>>>>    }
>>>>>>>       
>>>>>>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>>>>>>> ThrowIfNullWithMsg)
>>>>>>>    DeleteIfObject(p_poParser);
>>>>>>> }
>>>>>>>
>>>>>>> In the destructor of the Parser, I've got this : 
>>>>>>>
>>>>>>> ParserXML::~ParserXML()
>>>>>>> {   
>>>>>>>    #ifdef AFF
>>>>>>>       cout << "Destructeur de ParserXML" << endl;
>>>>>>>    #endif
>>>>>>>    
>>>>>>>    if (m_poDocument != NULL)
>>>>>>>    {
>>>>>>>       m_poDocument->release();
>>>>>>>    }
>>>>>>>    m_poDOMParser->reset();
>>>>>>>
>>>>>>>    DeleteIfObject(m_poDOMParser);
>>>>>>>    DeleteIfObject(m_poErrorHandler);
>>>>>>>    DeleteIfObject(m_poDOMDocument);
>>>>>>>    DeleteIfObject(m_poElementXML);
>>>>>>> }
>>>>>>>
>>>>>>> Some strange things happen, especially when I compare my code to the
>>>>>>> DOM
>>>>>>> Programming Guide Chapter "Constructing a XercesDOMParser"
>>>>>>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems
>>>>>>> that,
>>>>>>> to
>>>>>>> delete a parser and its ressources, one only have to delete the
>>>>>>> parser.
>>>>>>> If I do that, I get a core Dump while deleting the DOMDocument.
>>>>>>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>>>>>>> effect.
>>>>>>> Then I tried with m_poDOMParser->reset() and it did work! Well, not
>>>>>>> that
>>>>>>> much. Sometimes it does, sometimes it doesn't. I still get a core
>>>>>>> Dump
>>>>>>> sometimes, always when deleting the parser...
>>>>>>>
>>>>>>> Just for the record, here is the parsing method : 
>>>>>>>
>>>>>>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>>>>>>> {
>>>>>>>    #ifdef AFF
>>>>>>>       cout << "ParserXML::parse()" << endl;
>>>>>>>    #endif
>>>>>>>       
>>>>>>>    // Si aucun buffer n'est passé, on renvoie NULL
>>>>>>>    if (p_pcBuffer == NULL)
>>>>>>>    {
>>>>>>>       return NULL;
>>>>>>>    }
>>>>>>>    
>>>>>>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>>>>>>    if (m_bDocumentParsed)
>>>>>>>    {
>>>>>>>       if (m_poDocument != NULL)
>>>>>>>       {
>>>>>>>          m_poDocument->release();
>>>>>>>       }
>>>>>>>       m_poDOMParser->reset();
>>>>>>>       m_bDocumentParsed = false;
>>>>>>>    }
>>>>>>>    
>>>>>>>    char* l_pcMessage;
>>>>>>>    // on crée un objet pour le parsing
>>>>>>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>>>>>>                                     strlen(p_pcBuffer),
>>>>>>>                                     (const XMLCh*)  "ParserXML");
>>>>>>>    try
>>>>>>>    {
>>>>>>>       // on parse
>>>>>>>       m_poDOMParser->parse(l_oInputSource);
>>>>>>>       
>>>>>>>       // on récupère le DOMDocument parsé
>>>>>>>       m_poDocument = m_poDOMParser->getDocument();
>>>>>>>       
>>>>>>>       // on libère la mémoire si besoin
>>>>>>>       DeleteIfObject(m_poElementXML);
>>>>>>>       //on crée un nouveau ElementXML avec les données du
>>>>>>> DOMDocument
>>>>>>>       m_poElementXML = new
>>>>>>> ElementXML(m_poDocument->getDocumentElement());
>>>>>>>       // on indique que le Document a été correctement parsé
>>>>>>>       m_bDocumentParsed = true;
>>>>>>>       // on retourne l'ElementXML ainsi créé
>>>>>>>       return m_poElementXML;
>>>>>>>    }
>>>>>>>    catch(XMLException& XMLEx)
>>>>>>>    {
>>>>>>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>>>>>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>>       ex.doThrow();
>>>>>>>    }
>>>>>>>    catch(DOMException& DOMEx)
>>>>>>>    {
>>>>>>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>>>>>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>>       ex.doThrow();
>>>>>>>    }
>>>>>>>    catch(SAXParseException& SaxParseEx)
>>>>>>>    {
>>>>>>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>>>>>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>>       ex.doThrow();
>>>>>>>    }
>>>>>>>    catch(SAXException& SaxEx)
>>>>>>>    {
>>>>>>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>>>>>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>>       ex.doThrow();
>>>>>>>    }
>>>>>>>    catch(...)
>>>>>>>    {
>>>>>>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>>>>>>       ex.doThrow();
>>>>>>>    }
>>>>>>> }
>>>>>>>
>>>>>>> You just can't imagine how happy will I be when I won't have to code
>>>>>>> into
>>>>>>> this libraby :D
>>>>>>> Anyway, as always, if you find something weird, or even the tinniest
>>>>>>> clue,
>>>>>>> please, post here.
>>>>>>>
>>>>>>> Thanks a lot.
>>>>>>>
>>>>>>>   
>>>>>>>       
>>>>>>>           
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>>>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>     
>>>>>>         
>>>>>   
>>>>>       
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>>
>>>>
>>>>
>>>>     
>>>
>>>   
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23738426.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by radada <pa...@yahoo.fr>.
So I actually did the right thing, but I still get that damn memory leak...
I really don't understand where this could come from.
Since you have the code, if I could abuse, do you have any clue? I mean, the
code of the ParserXML object is pretty small, so I don't understand how can
this lead to a memory leak.

I use the parser this way : 

ServiceMEP* ServicePRC::getServiceMiseEnPaiement(const char* p_pcFluxPRC)
{
   ParserXML* l_poParser = NULL;
   ServiceMEP*  l_poService      = NULL;
   ElementXML*  l_poElementXML   = NULL;
   
   try
   {    
      //--- Convertit le flux en UTF-8
      DeleteIfObject(m_pcBuffer);
      m_pcBuffer= new char[(strlen(p_pcFluxPRC)*2) + 1];
      memset(m_pcBuffer, '\0', (strlen(p_pcFluxPRC)*2) + 1);
      XMLFactory::convertToUTF8(p_pcFluxPRC, m_pcBuffer);
      
      //--- Parse le flux de données et récupération de l'ElementXML
correspondant
      l_poParser = m_poXMLFactory->createParser();
      ThrowIfNullWithMsg(l_poParser, "Impossible de récupérer une instance
de ParserXML dans getServiceMiseEnPaiement");
      // parsing du flux proprement dit
      l_poElementXML = l_poParser->parse(m_pcBuffer);
      
      if (l_poElementXML != NULL)
         //--- Recuperation du document racine
         l_poService = new ServiceMEP(l_poElementXML);
      
      #ifdef DEBUG
         l_poService->PrintOn(cout);
      #endif
   
      //--- Nettoie les elements
      m_poXMLFactory->releaseParser(l_poParser);
      DeleteIfObject(m_pcBuffer);
      
      //--- Creation des objets entites 
      return l_poService;
   }

and of course, I delete the ServiceMEP* after using it. The ElementXML is
released by the parser since the Parser allocates the memory for the
Element.
Man I wish this was over : (
Thanks again.


Alberto Massari wrote:
> 
> In order to release the DOM trees owned by the parser, you either delete 
> the parser or call resetDocumentPool(). The reset() method is simply 
> initializing the internal variables before a parsing operation starts.
> 
>     /** Reset the parser
>       *
>       * This method resets the state of the DOM driver and makes
>       * it ready for a fresh parse run.
>       */
>     void reset();
> 
> 
>     /** Reset the documents vector pool and release all the associated 
> memory
>       * back to the system.
>       *
>       * When parsing a document using a DOM parser, all memory allocated
>       * for a DOM tree is associated to the DOM document.
>       *
>       * If you do multiple parse using the same DOM parser instance, then
>       * multiple DOM documents will be generated and saved in a vector
> pool.
>       * All these documents (and thus all the allocated memory)
>       * won't be deleted until the parser instance is destroyed.
>       *
>       * If you don't need these DOM documents anymore and don't want to
>       * destroy the DOM parser instance at this moment, then you can 
> call this method
>       * to reset the document vector pool and release all the allocated 
> memory
>       * back to the system.
>       *
>       * It is an error to call this method if you are in the middle of a
>       * parse (e.g. in the mid of a progressive parse).
>       *
>       * @exception IOException An exception from the parser if this
> function
>       *            is called when a parse is in progress.
>       *
>       */
>     void resetDocumentPool();
> 
> Alberto
> 
> radada ha scritto:
>> God this library is hard to use : (
>> So : the core dump is gone, thanks : ) (I removed the call to release and
>> the deletion of the DOMDocument)
>> But (there's always a but...), I get a memory leak now. This is why is
>> used
>> the reset() method on the parser at first I think.
>> The only way to release a parser and its associated objects is to delete
>> it
>> or is there another method to call?
>> Thanks, again : /
>>
>>
>> Alberto Massari wrote:
>>   
>>> If you use XercesDOMParser::getDocument to retrieve the parsed 
>>> DOMDocument, you should NOT call either DOMDocument::release or delete 
>>> the object, as the DOM tree is owned by the parsed and will be deleted 
>>> by him when you release it.
>>> If you are going to keep the parser for a long time, you may want to 
>>> handle the lifetime of the DOM tree yourself; but in that case you 
>>> should retrieve it from the parser by using 
>>> XercesDOMParser::adoptDocument, and you will have to use 
>>> DOMDocument::release to free it (don't use "delete" as it will not 
>>> perform all the cleanup, and in any case you are not assured it has been 
>>> created by the same "new" operator matching your "delete" operator).
>>>
>>> Alberto
>>>
>>> P.S. it is written in the documentation as well:
>>>
>>>     /** Get the DOM document
>>>       *
>>>       * This method returns the DOMDocument object representing the
>>>       * root of the document tree. This object provides the primary
>>>       * access to the document's data.
>>>       *
>>>       * The returned DOMDocument object is owned by the parser.
>>>       *
>>>       * @return The DOMDocument object which represents the entire
>>>       *         XML document.
>>>       */
>>>     DOMDocument* getDocument();
>>>
>>>     /** Adopt the DOM document
>>>       *
>>>       * This method returns the DOMDocument object representing the
>>>       * root of the document tree.
>>>       *
>>>       * The caller will adopt the DOMDocument and thus is responsible to
>>>       * call DOMDocument::release() to release the associated memory.
>>>       * The parser will not delete it.   The ownership is transferred
>>>       * from the parser to the caller.
>>>       *
>>>       * @return The adopted DOMDocument object which represents the
>>> entire
>>>       *         XML document.
>>>       */
>>>     DOMDocument* adoptDocument();
>>>
>>>
>>>
>>> radada ha scritto:
>>>     
>>>> Thanks Alberto, but I'm perplex now : should I call the release method
>>>> on
>>>> the
>>>> DOMDocument ou should I just delete it w/o calling release?
>>>> Thx man : )
>>>>
>>>>
>>>> Alberto Massari wrote:
>>>>   
>>>>       
>>>>> You shouldn't explicitly release a DOMDocument unless you adopted it 
>>>>> from the DOMParser, or it will try to release it after it has already 
>>>>> been deleted.
>>>>> You shouldn't also attempt to delete an object that you already
>>>>> released.
>>>>>
>>>>> Alberto
>>>>>
>>>>> radada ha scritto:
>>>>>     
>>>>>         
>>>>>> Hi there : )
>>>>>>
>>>>>> I think I'm going nuts : (
>>>>>> Thanks to Alberto, I've got a code which is approximatively good. As
>>>>>> told
>>>>>> in
>>>>>> a previous post, I implemented a functional layer over the xerces
>>>>>> library
>>>>>> so
>>>>>> that we can use it in our software at work.
>>>>>> In order to control as much as possible the memory leaks, I created a
>>>>>> singleton which can (and only it can) create DOMDocument and
>>>>>> XercesDOMParser. It is reponsible too for the releasing of the
>>>>>> objets.
>>>>>>
>>>>>> So for the parser, I've got a release method : 
>>>>>>
>>>>>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>>>>>> {  
>>>>>>    #ifdef AFF
>>>>>>       cout << "XMLFactory::releaseParser()" << endl;
>>>>>>    #endif
>>>>>>
>>>>>>
>>>>>>    // suppression en se basant sur les adresses des objets
>>>>>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>>>>>    {
>>>>>>       ParserXML* ptr = NULL;
>>>>>>       ptr = m_oListeParserXML.at(i);
>>>>>>       if (ptr == p_poParser)
>>>>>>          m_oListeParserXML.removeAt(i);
>>>>>>    }
>>>>>>       
>>>>>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>>>>>> ThrowIfNullWithMsg)
>>>>>>    DeleteIfObject(p_poParser);
>>>>>> }
>>>>>>
>>>>>> In the destructor of the Parser, I've got this : 
>>>>>>
>>>>>> ParserXML::~ParserXML()
>>>>>> {   
>>>>>>    #ifdef AFF
>>>>>>       cout << "Destructeur de ParserXML" << endl;
>>>>>>    #endif
>>>>>>    
>>>>>>    if (m_poDocument != NULL)
>>>>>>    {
>>>>>>       m_poDocument->release();
>>>>>>    }
>>>>>>    m_poDOMParser->reset();
>>>>>>
>>>>>>    DeleteIfObject(m_poDOMParser);
>>>>>>    DeleteIfObject(m_poErrorHandler);
>>>>>>    DeleteIfObject(m_poDOMDocument);
>>>>>>    DeleteIfObject(m_poElementXML);
>>>>>> }
>>>>>>
>>>>>> Some strange things happen, especially when I compare my code to the
>>>>>> DOM
>>>>>> Programming Guide Chapter "Constructing a XercesDOMParser"
>>>>>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems
>>>>>> that,
>>>>>> to
>>>>>> delete a parser and its ressources, one only have to delete the
>>>>>> parser.
>>>>>> If I do that, I get a core Dump while deleting the DOMDocument.
>>>>>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>>>>>> effect.
>>>>>> Then I tried with m_poDOMParser->reset() and it did work! Well, not
>>>>>> that
>>>>>> much. Sometimes it does, sometimes it doesn't. I still get a core
>>>>>> Dump
>>>>>> sometimes, always when deleting the parser...
>>>>>>
>>>>>> Just for the record, here is the parsing method : 
>>>>>>
>>>>>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>>>>>> {
>>>>>>    #ifdef AFF
>>>>>>       cout << "ParserXML::parse()" << endl;
>>>>>>    #endif
>>>>>>       
>>>>>>    // Si aucun buffer n'est passé, on renvoie NULL
>>>>>>    if (p_pcBuffer == NULL)
>>>>>>    {
>>>>>>       return NULL;
>>>>>>    }
>>>>>>    
>>>>>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>>>>>    if (m_bDocumentParsed)
>>>>>>    {
>>>>>>       if (m_poDocument != NULL)
>>>>>>       {
>>>>>>          m_poDocument->release();
>>>>>>       }
>>>>>>       m_poDOMParser->reset();
>>>>>>       m_bDocumentParsed = false;
>>>>>>    }
>>>>>>    
>>>>>>    char* l_pcMessage;
>>>>>>    // on crée un objet pour le parsing
>>>>>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>>>>>                                     strlen(p_pcBuffer),
>>>>>>                                     (const XMLCh*)  "ParserXML");
>>>>>>    try
>>>>>>    {
>>>>>>       // on parse
>>>>>>       m_poDOMParser->parse(l_oInputSource);
>>>>>>       
>>>>>>       // on récupère le DOMDocument parsé
>>>>>>       m_poDocument = m_poDOMParser->getDocument();
>>>>>>       
>>>>>>       // on libère la mémoire si besoin
>>>>>>       DeleteIfObject(m_poElementXML);
>>>>>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>>>>>       m_poElementXML = new
>>>>>> ElementXML(m_poDocument->getDocumentElement());
>>>>>>       // on indique que le Document a été correctement parsé
>>>>>>       m_bDocumentParsed = true;
>>>>>>       // on retourne l'ElementXML ainsi créé
>>>>>>       return m_poElementXML;
>>>>>>    }
>>>>>>    catch(XMLException& XMLEx)
>>>>>>    {
>>>>>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>>>>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>       ex.doThrow();
>>>>>>    }
>>>>>>    catch(DOMException& DOMEx)
>>>>>>    {
>>>>>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>>>>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>       ex.doThrow();
>>>>>>    }
>>>>>>    catch(SAXParseException& SaxParseEx)
>>>>>>    {
>>>>>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>>>>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>       ex.doThrow();
>>>>>>    }
>>>>>>    catch(SAXException& SaxEx)
>>>>>>    {
>>>>>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>>>>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>>>>>       XMLString::release(&l_pcMessage);
>>>>>>       ex.doThrow();
>>>>>>    }
>>>>>>    catch(...)
>>>>>>    {
>>>>>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>>>>>       ex.doThrow();
>>>>>>    }
>>>>>> }
>>>>>>
>>>>>> You just can't imagine how happy will I be when I won't have to code
>>>>>> into
>>>>>> this libraby :D
>>>>>> Anyway, as always, if you find something weird, or even the tinniest
>>>>>> clue,
>>>>>> please, post here.
>>>>>>
>>>>>> Thanks a lot.
>>>>>>
>>>>>>   
>>>>>>       
>>>>>>           
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>>>
>>>>>
>>>>>
>>>>>     
>>>>>         
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23593714.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by Alberto Massari <am...@datadirect.com>.
In order to release the DOM trees owned by the parser, you either delete 
the parser or call resetDocumentPool(). The reset() method is simply 
initializing the internal variables before a parsing operation starts.

    /** Reset the parser
      *
      * This method resets the state of the DOM driver and makes
      * it ready for a fresh parse run.
      */
    void reset();


    /** Reset the documents vector pool and release all the associated 
memory
      * back to the system.
      *
      * When parsing a document using a DOM parser, all memory allocated
      * for a DOM tree is associated to the DOM document.
      *
      * If you do multiple parse using the same DOM parser instance, then
      * multiple DOM documents will be generated and saved in a vector pool.
      * All these documents (and thus all the allocated memory)
      * won't be deleted until the parser instance is destroyed.
      *
      * If you don't need these DOM documents anymore and don't want to
      * destroy the DOM parser instance at this moment, then you can 
call this method
      * to reset the document vector pool and release all the allocated 
memory
      * back to the system.
      *
      * It is an error to call this method if you are in the middle of a
      * parse (e.g. in the mid of a progressive parse).
      *
      * @exception IOException An exception from the parser if this function
      *            is called when a parse is in progress.
      *
      */
    void resetDocumentPool();

Alberto

radada ha scritto:
> God this library is hard to use : (
> So : the core dump is gone, thanks : ) (I removed the call to release and
> the deletion of the DOMDocument)
> But (there's always a but...), I get a memory leak now. This is why is used
> the reset() method on the parser at first I think.
> The only way to release a parser and its associated objects is to delete it
> or is there another method to call?
> Thanks, again : /
>
>
> Alberto Massari wrote:
>   
>> If you use XercesDOMParser::getDocument to retrieve the parsed 
>> DOMDocument, you should NOT call either DOMDocument::release or delete 
>> the object, as the DOM tree is owned by the parsed and will be deleted 
>> by him when you release it.
>> If you are going to keep the parser for a long time, you may want to 
>> handle the lifetime of the DOM tree yourself; but in that case you 
>> should retrieve it from the parser by using 
>> XercesDOMParser::adoptDocument, and you will have to use 
>> DOMDocument::release to free it (don't use "delete" as it will not 
>> perform all the cleanup, and in any case you are not assured it has been 
>> created by the same "new" operator matching your "delete" operator).
>>
>> Alberto
>>
>> P.S. it is written in the documentation as well:
>>
>>     /** Get the DOM document
>>       *
>>       * This method returns the DOMDocument object representing the
>>       * root of the document tree. This object provides the primary
>>       * access to the document's data.
>>       *
>>       * The returned DOMDocument object is owned by the parser.
>>       *
>>       * @return The DOMDocument object which represents the entire
>>       *         XML document.
>>       */
>>     DOMDocument* getDocument();
>>
>>     /** Adopt the DOM document
>>       *
>>       * This method returns the DOMDocument object representing the
>>       * root of the document tree.
>>       *
>>       * The caller will adopt the DOMDocument and thus is responsible to
>>       * call DOMDocument::release() to release the associated memory.
>>       * The parser will not delete it.   The ownership is transferred
>>       * from the parser to the caller.
>>       *
>>       * @return The adopted DOMDocument object which represents the entire
>>       *         XML document.
>>       */
>>     DOMDocument* adoptDocument();
>>
>>
>>
>> radada ha scritto:
>>     
>>> Thanks Alberto, but I'm perplex now : should I call the release method on
>>> the
>>> DOMDocument ou should I just delete it w/o calling release?
>>> Thx man : )
>>>
>>>
>>> Alberto Massari wrote:
>>>   
>>>       
>>>> You shouldn't explicitly release a DOMDocument unless you adopted it 
>>>> from the DOMParser, or it will try to release it after it has already 
>>>> been deleted.
>>>> You shouldn't also attempt to delete an object that you already
>>>> released.
>>>>
>>>> Alberto
>>>>
>>>> radada ha scritto:
>>>>     
>>>>         
>>>>> Hi there : )
>>>>>
>>>>> I think I'm going nuts : (
>>>>> Thanks to Alberto, I've got a code which is approximatively good. As
>>>>> told
>>>>> in
>>>>> a previous post, I implemented a functional layer over the xerces
>>>>> library
>>>>> so
>>>>> that we can use it in our software at work.
>>>>> In order to control as much as possible the memory leaks, I created a
>>>>> singleton which can (and only it can) create DOMDocument and
>>>>> XercesDOMParser. It is reponsible too for the releasing of the objets.
>>>>>
>>>>> So for the parser, I've got a release method : 
>>>>>
>>>>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>>>>> {  
>>>>>    #ifdef AFF
>>>>>       cout << "XMLFactory::releaseParser()" << endl;
>>>>>    #endif
>>>>>
>>>>>
>>>>>    // suppression en se basant sur les adresses des objets
>>>>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>>>>    {
>>>>>       ParserXML* ptr = NULL;
>>>>>       ptr = m_oListeParserXML.at(i);
>>>>>       if (ptr == p_poParser)
>>>>>          m_oListeParserXML.removeAt(i);
>>>>>    }
>>>>>       
>>>>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>>>>> ThrowIfNullWithMsg)
>>>>>    DeleteIfObject(p_poParser);
>>>>> }
>>>>>
>>>>> In the destructor of the Parser, I've got this : 
>>>>>
>>>>> ParserXML::~ParserXML()
>>>>> {   
>>>>>    #ifdef AFF
>>>>>       cout << "Destructeur de ParserXML" << endl;
>>>>>    #endif
>>>>>    
>>>>>    if (m_poDocument != NULL)
>>>>>    {
>>>>>       m_poDocument->release();
>>>>>    }
>>>>>    m_poDOMParser->reset();
>>>>>
>>>>>    DeleteIfObject(m_poDOMParser);
>>>>>    DeleteIfObject(m_poErrorHandler);
>>>>>    DeleteIfObject(m_poDOMDocument);
>>>>>    DeleteIfObject(m_poElementXML);
>>>>> }
>>>>>
>>>>> Some strange things happen, especially when I compare my code to the
>>>>> DOM
>>>>> Programming Guide Chapter "Constructing a XercesDOMParser"
>>>>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that,
>>>>> to
>>>>> delete a parser and its ressources, one only have to delete the parser.
>>>>> If I do that, I get a core Dump while deleting the DOMDocument.
>>>>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>>>>> effect.
>>>>> Then I tried with m_poDOMParser->reset() and it did work! Well, not
>>>>> that
>>>>> much. Sometimes it does, sometimes it doesn't. I still get a core Dump
>>>>> sometimes, always when deleting the parser...
>>>>>
>>>>> Just for the record, here is the parsing method : 
>>>>>
>>>>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>>>>> {
>>>>>    #ifdef AFF
>>>>>       cout << "ParserXML::parse()" << endl;
>>>>>    #endif
>>>>>       
>>>>>    // Si aucun buffer n'est passé, on renvoie NULL
>>>>>    if (p_pcBuffer == NULL)
>>>>>    {
>>>>>       return NULL;
>>>>>    }
>>>>>    
>>>>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>>>>    if (m_bDocumentParsed)
>>>>>    {
>>>>>       if (m_poDocument != NULL)
>>>>>       {
>>>>>          m_poDocument->release();
>>>>>       }
>>>>>       m_poDOMParser->reset();
>>>>>       m_bDocumentParsed = false;
>>>>>    }
>>>>>    
>>>>>    char* l_pcMessage;
>>>>>    // on crée un objet pour le parsing
>>>>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>>>>                                     strlen(p_pcBuffer),
>>>>>                                     (const XMLCh*)  "ParserXML");
>>>>>    try
>>>>>    {
>>>>>       // on parse
>>>>>       m_poDOMParser->parse(l_oInputSource);
>>>>>       
>>>>>       // on récupère le DOMDocument parsé
>>>>>       m_poDocument = m_poDOMParser->getDocument();
>>>>>       
>>>>>       // on libère la mémoire si besoin
>>>>>       DeleteIfObject(m_poElementXML);
>>>>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>>>>       m_poElementXML = new
>>>>> ElementXML(m_poDocument->getDocumentElement());
>>>>>       // on indique que le Document a été correctement parsé
>>>>>       m_bDocumentParsed = true;
>>>>>       // on retourne l'ElementXML ainsi créé
>>>>>       return m_poElementXML;
>>>>>    }
>>>>>    catch(XMLException& XMLEx)
>>>>>    {
>>>>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>>>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>>>>       XMLString::release(&l_pcMessage);
>>>>>       ex.doThrow();
>>>>>    }
>>>>>    catch(DOMException& DOMEx)
>>>>>    {
>>>>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>>>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>>>>       XMLString::release(&l_pcMessage);
>>>>>       ex.doThrow();
>>>>>    }
>>>>>    catch(SAXParseException& SaxParseEx)
>>>>>    {
>>>>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>>>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>>>>       XMLString::release(&l_pcMessage);
>>>>>       ex.doThrow();
>>>>>    }
>>>>>    catch(SAXException& SaxEx)
>>>>>    {
>>>>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>>>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>>>>       XMLString::release(&l_pcMessage);
>>>>>       ex.doThrow();
>>>>>    }
>>>>>    catch(...)
>>>>>    {
>>>>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>>>>       ex.doThrow();
>>>>>    }
>>>>> }
>>>>>
>>>>> You just can't imagine how happy will I be when I won't have to code
>>>>> into
>>>>> this libraby :D
>>>>> Anyway, as always, if you find something weird, or even the tinniest
>>>>> clue,
>>>>> please, post here.
>>>>>
>>>>> Thanks a lot.
>>>>>
>>>>>   
>>>>>       
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>>
>>>>
>>>>
>>>>     
>>>>         
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by radada <pa...@yahoo.fr>.
God this library is hard to use : (
So : the core dump is gone, thanks : ) (I removed the call to release and
the deletion of the DOMDocument)
But (there's always a but...), I get a memory leak now. This is why is used
the reset() method on the parser at first I think.
The only way to release a parser and its associated objects is to delete it
or is there another method to call?
Thanks, again : /


Alberto Massari wrote:
> 
> If you use XercesDOMParser::getDocument to retrieve the parsed 
> DOMDocument, you should NOT call either DOMDocument::release or delete 
> the object, as the DOM tree is owned by the parsed and will be deleted 
> by him when you release it.
> If you are going to keep the parser for a long time, you may want to 
> handle the lifetime of the DOM tree yourself; but in that case you 
> should retrieve it from the parser by using 
> XercesDOMParser::adoptDocument, and you will have to use 
> DOMDocument::release to free it (don't use "delete" as it will not 
> perform all the cleanup, and in any case you are not assured it has been 
> created by the same "new" operator matching your "delete" operator).
> 
> Alberto
> 
> P.S. it is written in the documentation as well:
> 
>     /** Get the DOM document
>       *
>       * This method returns the DOMDocument object representing the
>       * root of the document tree. This object provides the primary
>       * access to the document's data.
>       *
>       * The returned DOMDocument object is owned by the parser.
>       *
>       * @return The DOMDocument object which represents the entire
>       *         XML document.
>       */
>     DOMDocument* getDocument();
> 
>     /** Adopt the DOM document
>       *
>       * This method returns the DOMDocument object representing the
>       * root of the document tree.
>       *
>       * The caller will adopt the DOMDocument and thus is responsible to
>       * call DOMDocument::release() to release the associated memory.
>       * The parser will not delete it.   The ownership is transferred
>       * from the parser to the caller.
>       *
>       * @return The adopted DOMDocument object which represents the entire
>       *         XML document.
>       */
>     DOMDocument* adoptDocument();
> 
> 
> 
> radada ha scritto:
>> Thanks Alberto, but I'm perplex now : should I call the release method on
>> the
>> DOMDocument ou should I just delete it w/o calling release?
>> Thx man : )
>>
>>
>> Alberto Massari wrote:
>>   
>>> You shouldn't explicitly release a DOMDocument unless you adopted it 
>>> from the DOMParser, or it will try to release it after it has already 
>>> been deleted.
>>> You shouldn't also attempt to delete an object that you already
>>> released.
>>>
>>> Alberto
>>>
>>> radada ha scritto:
>>>     
>>>> Hi there : )
>>>>
>>>> I think I'm going nuts : (
>>>> Thanks to Alberto, I've got a code which is approximatively good. As
>>>> told
>>>> in
>>>> a previous post, I implemented a functional layer over the xerces
>>>> library
>>>> so
>>>> that we can use it in our software at work.
>>>> In order to control as much as possible the memory leaks, I created a
>>>> singleton which can (and only it can) create DOMDocument and
>>>> XercesDOMParser. It is reponsible too for the releasing of the objets.
>>>>
>>>> So for the parser, I've got a release method : 
>>>>
>>>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>>>> {  
>>>>    #ifdef AFF
>>>>       cout << "XMLFactory::releaseParser()" << endl;
>>>>    #endif
>>>>
>>>>
>>>>    // suppression en se basant sur les adresses des objets
>>>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>>>    {
>>>>       ParserXML* ptr = NULL;
>>>>       ptr = m_oListeParserXML.at(i);
>>>>       if (ptr == p_poParser)
>>>>          m_oListeParserXML.removeAt(i);
>>>>    }
>>>>       
>>>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>>>> ThrowIfNullWithMsg)
>>>>    DeleteIfObject(p_poParser);
>>>> }
>>>>
>>>> In the destructor of the Parser, I've got this : 
>>>>
>>>> ParserXML::~ParserXML()
>>>> {   
>>>>    #ifdef AFF
>>>>       cout << "Destructeur de ParserXML" << endl;
>>>>    #endif
>>>>    
>>>>    if (m_poDocument != NULL)
>>>>    {
>>>>       m_poDocument->release();
>>>>    }
>>>>    m_poDOMParser->reset();
>>>>
>>>>    DeleteIfObject(m_poDOMParser);
>>>>    DeleteIfObject(m_poErrorHandler);
>>>>    DeleteIfObject(m_poDOMDocument);
>>>>    DeleteIfObject(m_poElementXML);
>>>> }
>>>>
>>>> Some strange things happen, especially when I compare my code to the
>>>> DOM
>>>> Programming Guide Chapter "Constructing a XercesDOMParser"
>>>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that,
>>>> to
>>>> delete a parser and its ressources, one only have to delete the parser.
>>>> If I do that, I get a core Dump while deleting the DOMDocument.
>>>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>>>> effect.
>>>> Then I tried with m_poDOMParser->reset() and it did work! Well, not
>>>> that
>>>> much. Sometimes it does, sometimes it doesn't. I still get a core Dump
>>>> sometimes, always when deleting the parser...
>>>>
>>>> Just for the record, here is the parsing method : 
>>>>
>>>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>>>> {
>>>>    #ifdef AFF
>>>>       cout << "ParserXML::parse()" << endl;
>>>>    #endif
>>>>       
>>>>    // Si aucun buffer n'est passé, on renvoie NULL
>>>>    if (p_pcBuffer == NULL)
>>>>    {
>>>>       return NULL;
>>>>    }
>>>>    
>>>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>>>    if (m_bDocumentParsed)
>>>>    {
>>>>       if (m_poDocument != NULL)
>>>>       {
>>>>          m_poDocument->release();
>>>>       }
>>>>       m_poDOMParser->reset();
>>>>       m_bDocumentParsed = false;
>>>>    }
>>>>    
>>>>    char* l_pcMessage;
>>>>    // on crée un objet pour le parsing
>>>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>>>                                     strlen(p_pcBuffer),
>>>>                                     (const XMLCh*)  "ParserXML");
>>>>    try
>>>>    {
>>>>       // on parse
>>>>       m_poDOMParser->parse(l_oInputSource);
>>>>       
>>>>       // on récupère le DOMDocument parsé
>>>>       m_poDocument = m_poDOMParser->getDocument();
>>>>       
>>>>       // on libère la mémoire si besoin
>>>>       DeleteIfObject(m_poElementXML);
>>>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>>>       m_poElementXML = new
>>>> ElementXML(m_poDocument->getDocumentElement());
>>>>       // on indique que le Document a été correctement parsé
>>>>       m_bDocumentParsed = true;
>>>>       // on retourne l'ElementXML ainsi créé
>>>>       return m_poElementXML;
>>>>    }
>>>>    catch(XMLException& XMLEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(DOMException& DOMEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(SAXParseException& SaxParseEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(SAXException& SaxEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(...)
>>>>    {
>>>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>>>       ex.doThrow();
>>>>    }
>>>> }
>>>>
>>>> You just can't imagine how happy will I be when I won't have to code
>>>> into
>>>> this libraby :D
>>>> Anyway, as always, if you find something weird, or even the tinniest
>>>> clue,
>>>> please, post here.
>>>>
>>>> Thanks a lot.
>>>>
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23592934.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by radada <pa...@yahoo.fr>.
Actually, I instanciate a new Parser for each reading, so the lifetime of the
document is pretty small.
I'll try that monday at work, I don't have the sources here.
I will never say it enough, but really, thanks a lot Alberto : )


Alberto Massari wrote:
> 
> If you use XercesDOMParser::getDocument to retrieve the parsed 
> DOMDocument, you should NOT call either DOMDocument::release or delete 
> the object, as the DOM tree is owned by the parsed and will be deleted 
> by him when you release it.
> If you are going to keep the parser for a long time, you may want to 
> handle the lifetime of the DOM tree yourself; but in that case you 
> should retrieve it from the parser by using 
> XercesDOMParser::adoptDocument, and you will have to use 
> DOMDocument::release to free it (don't use "delete" as it will not 
> perform all the cleanup, and in any case you are not assured it has been 
> created by the same "new" operator matching your "delete" operator).
> 
> Alberto
> 
> P.S. it is written in the documentation as well:
> 
>     /** Get the DOM document
>       *
>       * This method returns the DOMDocument object representing the
>       * root of the document tree. This object provides the primary
>       * access to the document's data.
>       *
>       * The returned DOMDocument object is owned by the parser.
>       *
>       * @return The DOMDocument object which represents the entire
>       *         XML document.
>       */
>     DOMDocument* getDocument();
> 
>     /** Adopt the DOM document
>       *
>       * This method returns the DOMDocument object representing the
>       * root of the document tree.
>       *
>       * The caller will adopt the DOMDocument and thus is responsible to
>       * call DOMDocument::release() to release the associated memory.
>       * The parser will not delete it.   The ownership is transferred
>       * from the parser to the caller.
>       *
>       * @return The adopted DOMDocument object which represents the entire
>       *         XML document.
>       */
>     DOMDocument* adoptDocument();
> 
> 
> 
> radada ha scritto:
>> Thanks Alberto, but I'm perplex now : should I call the release method on
>> the
>> DOMDocument ou should I just delete it w/o calling release?
>> Thx man : )
>>
>>
>> Alberto Massari wrote:
>>   
>>> You shouldn't explicitly release a DOMDocument unless you adopted it 
>>> from the DOMParser, or it will try to release it after it has already 
>>> been deleted.
>>> You shouldn't also attempt to delete an object that you already
>>> released.
>>>
>>> Alberto
>>>
>>> radada ha scritto:
>>>     
>>>> Hi there : )
>>>>
>>>> I think I'm going nuts : (
>>>> Thanks to Alberto, I've got a code which is approximatively good. As
>>>> told
>>>> in
>>>> a previous post, I implemented a functional layer over the xerces
>>>> library
>>>> so
>>>> that we can use it in our software at work.
>>>> In order to control as much as possible the memory leaks, I created a
>>>> singleton which can (and only it can) create DOMDocument and
>>>> XercesDOMParser. It is reponsible too for the releasing of the objets.
>>>>
>>>> So for the parser, I've got a release method : 
>>>>
>>>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>>>> {  
>>>>    #ifdef AFF
>>>>       cout << "XMLFactory::releaseParser()" << endl;
>>>>    #endif
>>>>
>>>>
>>>>    // suppression en se basant sur les adresses des objets
>>>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>>>    {
>>>>       ParserXML* ptr = NULL;
>>>>       ptr = m_oListeParserXML.at(i);
>>>>       if (ptr == p_poParser)
>>>>          m_oListeParserXML.removeAt(i);
>>>>    }
>>>>       
>>>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>>>> ThrowIfNullWithMsg)
>>>>    DeleteIfObject(p_poParser);
>>>> }
>>>>
>>>> In the destructor of the Parser, I've got this : 
>>>>
>>>> ParserXML::~ParserXML()
>>>> {   
>>>>    #ifdef AFF
>>>>       cout << "Destructeur de ParserXML" << endl;
>>>>    #endif
>>>>    
>>>>    if (m_poDocument != NULL)
>>>>    {
>>>>       m_poDocument->release();
>>>>    }
>>>>    m_poDOMParser->reset();
>>>>
>>>>    DeleteIfObject(m_poDOMParser);
>>>>    DeleteIfObject(m_poErrorHandler);
>>>>    DeleteIfObject(m_poDOMDocument);
>>>>    DeleteIfObject(m_poElementXML);
>>>> }
>>>>
>>>> Some strange things happen, especially when I compare my code to the
>>>> DOM
>>>> Programming Guide Chapter "Constructing a XercesDOMParser"
>>>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that,
>>>> to
>>>> delete a parser and its ressources, one only have to delete the parser.
>>>> If I do that, I get a core Dump while deleting the DOMDocument.
>>>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>>>> effect.
>>>> Then I tried with m_poDOMParser->reset() and it did work! Well, not
>>>> that
>>>> much. Sometimes it does, sometimes it doesn't. I still get a core Dump
>>>> sometimes, always when deleting the parser...
>>>>
>>>> Just for the record, here is the parsing method : 
>>>>
>>>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>>>> {
>>>>    #ifdef AFF
>>>>       cout << "ParserXML::parse()" << endl;
>>>>    #endif
>>>>       
>>>>    // Si aucun buffer n'est passé, on renvoie NULL
>>>>    if (p_pcBuffer == NULL)
>>>>    {
>>>>       return NULL;
>>>>    }
>>>>    
>>>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>>>    if (m_bDocumentParsed)
>>>>    {
>>>>       if (m_poDocument != NULL)
>>>>       {
>>>>          m_poDocument->release();
>>>>       }
>>>>       m_poDOMParser->reset();
>>>>       m_bDocumentParsed = false;
>>>>    }
>>>>    
>>>>    char* l_pcMessage;
>>>>    // on crée un objet pour le parsing
>>>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>>>                                     strlen(p_pcBuffer),
>>>>                                     (const XMLCh*)  "ParserXML");
>>>>    try
>>>>    {
>>>>       // on parse
>>>>       m_poDOMParser->parse(l_oInputSource);
>>>>       
>>>>       // on récupère le DOMDocument parsé
>>>>       m_poDocument = m_poDOMParser->getDocument();
>>>>       
>>>>       // on libère la mémoire si besoin
>>>>       DeleteIfObject(m_poElementXML);
>>>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>>>       m_poElementXML = new
>>>> ElementXML(m_poDocument->getDocumentElement());
>>>>       // on indique que le Document a été correctement parsé
>>>>       m_bDocumentParsed = true;
>>>>       // on retourne l'ElementXML ainsi créé
>>>>       return m_poElementXML;
>>>>    }
>>>>    catch(XMLException& XMLEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(DOMException& DOMEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(SAXParseException& SaxParseEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(SAXException& SaxEx)
>>>>    {
>>>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>>>       XMLString::release(&l_pcMessage);
>>>>       ex.doThrow();
>>>>    }
>>>>    catch(...)
>>>>    {
>>>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>>>       ex.doThrow();
>>>>    }
>>>> }
>>>>
>>>> You just can't imagine how happy will I be when I won't have to code
>>>> into
>>>> this libraby :D
>>>> Anyway, as always, if you find something weird, or even the tinniest
>>>> clue,
>>>> please, post here.
>>>>
>>>> Thanks a lot.
>>>>
>>>>   
>>>>       
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23566135.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by Alberto Massari <am...@datadirect.com>.
If you use XercesDOMParser::getDocument to retrieve the parsed 
DOMDocument, you should NOT call either DOMDocument::release or delete 
the object, as the DOM tree is owned by the parsed and will be deleted 
by him when you release it.
If you are going to keep the parser for a long time, you may want to 
handle the lifetime of the DOM tree yourself; but in that case you 
should retrieve it from the parser by using 
XercesDOMParser::adoptDocument, and you will have to use 
DOMDocument::release to free it (don't use "delete" as it will not 
perform all the cleanup, and in any case you are not assured it has been 
created by the same "new" operator matching your "delete" operator).

Alberto

P.S. it is written in the documentation as well:

    /** Get the DOM document
      *
      * This method returns the DOMDocument object representing the
      * root of the document tree. This object provides the primary
      * access to the document's data.
      *
      * The returned DOMDocument object is owned by the parser.
      *
      * @return The DOMDocument object which represents the entire
      *         XML document.
      */
    DOMDocument* getDocument();

    /** Adopt the DOM document
      *
      * This method returns the DOMDocument object representing the
      * root of the document tree.
      *
      * The caller will adopt the DOMDocument and thus is responsible to
      * call DOMDocument::release() to release the associated memory.
      * The parser will not delete it.   The ownership is transferred
      * from the parser to the caller.
      *
      * @return The adopted DOMDocument object which represents the entire
      *         XML document.
      */
    DOMDocument* adoptDocument();



radada ha scritto:
> Thanks Alberto, but I'm perplex now : should I call the release method on the
> DOMDocument ou should I just delete it w/o calling release?
> Thx man : )
>
>
> Alberto Massari wrote:
>   
>> You shouldn't explicitly release a DOMDocument unless you adopted it 
>> from the DOMParser, or it will try to release it after it has already 
>> been deleted.
>> You shouldn't also attempt to delete an object that you already released.
>>
>> Alberto
>>
>> radada ha scritto:
>>     
>>> Hi there : )
>>>
>>> I think I'm going nuts : (
>>> Thanks to Alberto, I've got a code which is approximatively good. As told
>>> in
>>> a previous post, I implemented a functional layer over the xerces library
>>> so
>>> that we can use it in our software at work.
>>> In order to control as much as possible the memory leaks, I created a
>>> singleton which can (and only it can) create DOMDocument and
>>> XercesDOMParser. It is reponsible too for the releasing of the objets.
>>>
>>> So for the parser, I've got a release method : 
>>>
>>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>>> {  
>>>    #ifdef AFF
>>>       cout << "XMLFactory::releaseParser()" << endl;
>>>    #endif
>>>
>>>
>>>    // suppression en se basant sur les adresses des objets
>>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>>    {
>>>       ParserXML* ptr = NULL;
>>>       ptr = m_oListeParserXML.at(i);
>>>       if (ptr == p_poParser)
>>>          m_oListeParserXML.removeAt(i);
>>>    }
>>>       
>>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>>> ThrowIfNullWithMsg)
>>>    DeleteIfObject(p_poParser);
>>> }
>>>
>>> In the destructor of the Parser, I've got this : 
>>>
>>> ParserXML::~ParserXML()
>>> {   
>>>    #ifdef AFF
>>>       cout << "Destructeur de ParserXML" << endl;
>>>    #endif
>>>    
>>>    if (m_poDocument != NULL)
>>>    {
>>>       m_poDocument->release();
>>>    }
>>>    m_poDOMParser->reset();
>>>
>>>    DeleteIfObject(m_poDOMParser);
>>>    DeleteIfObject(m_poErrorHandler);
>>>    DeleteIfObject(m_poDOMDocument);
>>>    DeleteIfObject(m_poElementXML);
>>> }
>>>
>>> Some strange things happen, especially when I compare my code to the DOM
>>> Programming Guide Chapter "Constructing a XercesDOMParser"
>>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that, to
>>> delete a parser and its ressources, one only have to delete the parser.
>>> If I do that, I get a core Dump while deleting the DOMDocument.
>>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>>> effect.
>>> Then I tried with m_poDOMParser->reset() and it did work! Well, not that
>>> much. Sometimes it does, sometimes it doesn't. I still get a core Dump
>>> sometimes, always when deleting the parser...
>>>
>>> Just for the record, here is the parsing method : 
>>>
>>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>>> {
>>>    #ifdef AFF
>>>       cout << "ParserXML::parse()" << endl;
>>>    #endif
>>>       
>>>    // Si aucun buffer n'est passé, on renvoie NULL
>>>    if (p_pcBuffer == NULL)
>>>    {
>>>       return NULL;
>>>    }
>>>    
>>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>>    if (m_bDocumentParsed)
>>>    {
>>>       if (m_poDocument != NULL)
>>>       {
>>>          m_poDocument->release();
>>>       }
>>>       m_poDOMParser->reset();
>>>       m_bDocumentParsed = false;
>>>    }
>>>    
>>>    char* l_pcMessage;
>>>    // on crée un objet pour le parsing
>>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>>                                     strlen(p_pcBuffer),
>>>                                     (const XMLCh*)  "ParserXML");
>>>    try
>>>    {
>>>       // on parse
>>>       m_poDOMParser->parse(l_oInputSource);
>>>       
>>>       // on récupère le DOMDocument parsé
>>>       m_poDocument = m_poDOMParser->getDocument();
>>>       
>>>       // on libère la mémoire si besoin
>>>       DeleteIfObject(m_poElementXML);
>>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>>       m_poElementXML = new
>>> ElementXML(m_poDocument->getDocumentElement());
>>>       // on indique que le Document a été correctement parsé
>>>       m_bDocumentParsed = true;
>>>       // on retourne l'ElementXML ainsi créé
>>>       return m_poElementXML;
>>>    }
>>>    catch(XMLException& XMLEx)
>>>    {
>>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>>       XMLString::release(&l_pcMessage);
>>>       ex.doThrow();
>>>    }
>>>    catch(DOMException& DOMEx)
>>>    {
>>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>>       XMLString::release(&l_pcMessage);
>>>       ex.doThrow();
>>>    }
>>>    catch(SAXParseException& SaxParseEx)
>>>    {
>>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>>       XMLString::release(&l_pcMessage);
>>>       ex.doThrow();
>>>    }
>>>    catch(SAXException& SaxEx)
>>>    {
>>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>>       XMLString::release(&l_pcMessage);
>>>       ex.doThrow();
>>>    }
>>>    catch(...)
>>>    {
>>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>>       ex.doThrow();
>>>    }
>>> }
>>>
>>> You just can't imagine how happy will I be when I won't have to code into
>>> this libraby :D
>>> Anyway, as always, if you find something weird, or even the tinniest
>>> clue,
>>> please, post here.
>>>
>>> Thanks a lot.
>>>
>>>   
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: c-dev-help@xerces.apache.org
>>
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by radada <pa...@yahoo.fr>.
Thanks Alberto, but I'm perplex now : should I call the release method on the
DOMDocument ou should I just delete it w/o calling release?
Thx man : )


Alberto Massari wrote:
> 
> You shouldn't explicitly release a DOMDocument unless you adopted it 
> from the DOMParser, or it will try to release it after it has already 
> been deleted.
> You shouldn't also attempt to delete an object that you already released.
> 
> Alberto
> 
> radada ha scritto:
>> Hi there : )
>>
>> I think I'm going nuts : (
>> Thanks to Alberto, I've got a code which is approximatively good. As told
>> in
>> a previous post, I implemented a functional layer over the xerces library
>> so
>> that we can use it in our software at work.
>> In order to control as much as possible the memory leaks, I created a
>> singleton which can (and only it can) create DOMDocument and
>> XercesDOMParser. It is reponsible too for the releasing of the objets.
>>
>> So for the parser, I've got a release method : 
>>
>> void XMLFactory::releaseParser(ParserXML* p_poParser)
>> {  
>>    #ifdef AFF
>>       cout << "XMLFactory::releaseParser()" << endl;
>>    #endif
>>
>>
>>    // suppression en se basant sur les adresses des objets
>>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>>    {
>>       ParserXML* ptr = NULL;
>>       ptr = m_oListeParserXML.at(i);
>>       if (ptr == p_poParser)
>>          m_oListeParserXML.removeAt(i);
>>    }
>>       
>>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
>> ThrowIfNullWithMsg)
>>    DeleteIfObject(p_poParser);
>> }
>>
>> In the destructor of the Parser, I've got this : 
>>
>> ParserXML::~ParserXML()
>> {   
>>    #ifdef AFF
>>       cout << "Destructeur de ParserXML" << endl;
>>    #endif
>>    
>>    if (m_poDocument != NULL)
>>    {
>>       m_poDocument->release();
>>    }
>>    m_poDOMParser->reset();
>>
>>    DeleteIfObject(m_poDOMParser);
>>    DeleteIfObject(m_poErrorHandler);
>>    DeleteIfObject(m_poDOMDocument);
>>    DeleteIfObject(m_poElementXML);
>> }
>>
>> Some strange things happen, especially when I compare my code to the DOM
>> Programming Guide Chapter "Constructing a XercesDOMParser"
>> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that, to
>> delete a parser and its ressources, one only have to delete the parser.
>> If I do that, I get a core Dump while deleting the DOMDocument.
>> So I added a m_poDOMParser->resetDocumentPool(), but it had the same
>> effect.
>> Then I tried with m_poDOMParser->reset() and it did work! Well, not that
>> much. Sometimes it does, sometimes it doesn't. I still get a core Dump
>> sometimes, always when deleting the parser...
>>
>> Just for the record, here is the parsing method : 
>>
>>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
>> {
>>    #ifdef AFF
>>       cout << "ParserXML::parse()" << endl;
>>    #endif
>>       
>>    // Si aucun buffer n'est passé, on renvoie NULL
>>    if (p_pcBuffer == NULL)
>>    {
>>       return NULL;
>>    }
>>    
>>    // si le parser n'a pas libéré les ressources du précédent parse   
>>    if (m_bDocumentParsed)
>>    {
>>       if (m_poDocument != NULL)
>>       {
>>          m_poDocument->release();
>>       }
>>       m_poDOMParser->reset();
>>       m_bDocumentParsed = false;
>>    }
>>    
>>    char* l_pcMessage;
>>    // on crée un objet pour le parsing
>>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>>                                     strlen(p_pcBuffer),
>>                                     (const XMLCh*)  "ParserXML");
>>    try
>>    {
>>       // on parse
>>       m_poDOMParser->parse(l_oInputSource);
>>       
>>       // on récupère le DOMDocument parsé
>>       m_poDocument = m_poDOMParser->getDocument();
>>       
>>       // on libère la mémoire si besoin
>>       DeleteIfObject(m_poElementXML);
>>       //on crée un nouveau ElementXML avec les données du DOMDocument
>>       m_poElementXML = new
>> ElementXML(m_poDocument->getDocumentElement());
>>       // on indique que le Document a été correctement parsé
>>       m_bDocumentParsed = true;
>>       // on retourne l'ElementXML ainsi créé
>>       return m_poElementXML;
>>    }
>>    catch(XMLException& XMLEx)
>>    {
>>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>>       XMLString::release(&l_pcMessage);
>>       ex.doThrow();
>>    }
>>    catch(DOMException& DOMEx)
>>    {
>>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>>       XMLString::release(&l_pcMessage);
>>       ex.doThrow();
>>    }
>>    catch(SAXParseException& SaxParseEx)
>>    {
>>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>>       XMLString::release(&l_pcMessage);
>>       ex.doThrow();
>>    }
>>    catch(SAXException& SaxEx)
>>    {
>>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>>       XMLString::release(&l_pcMessage);
>>       ex.doThrow();
>>    }
>>    catch(...)
>>    {
>>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>>       ex.doThrow();
>>    }
>> }
>>
>> You just can't imagine how happy will I be when I won't have to code into
>> this libraby :D
>> Anyway, as always, if you find something weird, or even the tinniest
>> clue,
>> please, post here.
>>
>> Thanks a lot.
>>
>>   
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: c-dev-help@xerces.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Core-Dump-while-releasing-Parser-ressources...-tp23560721p23565333.html
Sent from the Xerces - C - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org


Re: Core Dump while releasing Parser ressources...

Posted by Alberto Massari <am...@datadirect.com>.
You shouldn't explicitly release a DOMDocument unless you adopted it 
from the DOMParser, or it will try to release it after it has already 
been deleted.
You shouldn't also attempt to delete an object that you already released.

Alberto

radada ha scritto:
> Hi there : )
>
> I think I'm going nuts : (
> Thanks to Alberto, I've got a code which is approximatively good. As told in
> a previous post, I implemented a functional layer over the xerces library so
> that we can use it in our software at work.
> In order to control as much as possible the memory leaks, I created a
> singleton which can (and only it can) create DOMDocument and
> XercesDOMParser. It is reponsible too for the releasing of the objets.
>
> So for the parser, I've got a release method : 
>
> void XMLFactory::releaseParser(ParserXML* p_poParser)
> {  
>    #ifdef AFF
>       cout << "XMLFactory::releaseParser()" << endl;
>    #endif
>
>
>    // suppression en se basant sur les adresses des objets
>    for (int i=0; i<m_oListeParserXML.entries(); i++)
>    {
>       ParserXML* ptr = NULL;
>       ptr = m_oListeParserXML.at(i);
>       if (ptr == p_poParser)
>          m_oListeParserXML.removeAt(i);
>    }
>       
>    // on delete l'objet (on test avant s'il n'est pas NULL avec le
> ThrowIfNullWithMsg)
>    DeleteIfObject(p_poParser);
> }
>
> In the destructor of the Parser, I've got this : 
>
> ParserXML::~ParserXML()
> {   
>    #ifdef AFF
>       cout << "Destructeur de ParserXML" << endl;
>    #endif
>    
>    if (m_poDocument != NULL)
>    {
>       m_poDocument->release();
>    }
>    m_poDOMParser->reset();
>
>    DeleteIfObject(m_poDOMParser);
>    DeleteIfObject(m_poErrorHandler);
>    DeleteIfObject(m_poDOMDocument);
>    DeleteIfObject(m_poElementXML);
> }
>
> Some strange things happen, especially when I compare my code to the DOM
> Programming Guide Chapter "Constructing a XercesDOMParser"
> (http://xerces.apache.org/xerces-c/program-dom-3.html). It seems that, to
> delete a parser and its ressources, one only have to delete the parser.
> If I do that, I get a core Dump while deleting the DOMDocument.
> So I added a m_poDOMParser->resetDocumentPool(), but it had the same effect.
> Then I tried with m_poDOMParser->reset() and it did work! Well, not that
> much. Sometimes it does, sometimes it doesn't. I still get a core Dump
> sometimes, always when deleting the parser...
>
> Just for the record, here is the parsing method : 
>
>  ElementXML* ParserXML::parse(const char* p_pcBuffer)
> {
>    #ifdef AFF
>       cout << "ParserXML::parse()" << endl;
>    #endif
>       
>    // Si aucun buffer n'est passé, on renvoie NULL
>    if (p_pcBuffer == NULL)
>    {
>       return NULL;
>    }
>    
>    // si le parser n'a pas libéré les ressources du précédent parse   
>    if (m_bDocumentParsed)
>    {
>       if (m_poDocument != NULL)
>       {
>          m_poDocument->release();
>       }
>       m_poDOMParser->reset();
>       m_bDocumentParsed = false;
>    }
>    
>    char* l_pcMessage;
>    // on crée un objet pour le parsing
>    MemBufInputSource l_oInputSource((const XMLByte*)p_pcBuffer,
>                                     strlen(p_pcBuffer),
>                                     (const XMLCh*)  "ParserXML");
>    try
>    {
>       // on parse
>       m_poDOMParser->parse(l_oInputSource);
>       
>       // on récupère le DOMDocument parsé
>       m_poDocument = m_poDOMParser->getDocument();
>       
>       // on libère la mémoire si besoin
>       DeleteIfObject(m_poElementXML);
>       //on crée un nouveau ElementXML avec les données du DOMDocument
>       m_poElementXML = new ElementXML(m_poDocument->getDocumentElement());
>       // on indique que le Document a été correctement parsé
>       m_bDocumentParsed = true;
>       // on retourne l'ElementXML ainsi créé
>       return m_poElementXML;
>    }
>    catch(XMLException& XMLEx)
>    {
>       l_pcMessage = XMLString::transcode(XMLEx.getMessage());
>       ExceptMessage ex("T00500", "XML Exception", l_pcMessage);
>       XMLString::release(&l_pcMessage);
>       ex.doThrow();
>    }
>    catch(DOMException& DOMEx)
>    {
>       l_pcMessage = XMLString::transcode(DOMEx.msg);
>       ExceptMessage ex("T00501", "XML Exception", l_pcMessage);
>       XMLString::release(&l_pcMessage);
>       ex.doThrow();
>    }
>    catch(SAXParseException& SaxParseEx)
>    {
>       l_pcMessage = XMLString::transcode(SaxParseEx.getMessage());
>       ExceptMessage ex("T00502", "SAXParse Exception", l_pcMessage);
>       XMLString::release(&l_pcMessage);
>       ex.doThrow();
>    }
>    catch(SAXException& SaxEx)
>    {
>       l_pcMessage = XMLString::transcode(SaxEx.getMessage());
>       ExceptMessage ex("T00502", "SAX Exception", l_pcMessage);
>       XMLString::release(&l_pcMessage);
>       ex.doThrow();
>    }
>    catch(...)
>    {
>       ExceptMessage ex("T00450", " ", "Erreur inconnue");
>       ex.doThrow();
>    }
> }
>
> You just can't imagine how happy will I be when I won't have to code into
> this libraby :D
> Anyway, as always, if you find something weird, or even the tinniest clue,
> please, post here.
>
> Thanks a lot.
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org