Hi Vladimir,

XercesDOMWrapperParsedSource should destroy the document in creates, which
it does.  The bug was in XercesParserLiaison::destroyDocument() which
failed to destroy a document it created.  Users should not have to call
XercesParserLiaison::reset() in this case.

Dave



                                                                       
                      Vladimir Marek                                   
                      <[EMAIL PROTECTED]         To:      [EMAIL PROTECTED]
                      .cz>                     cc:      (bcc: David N 
Bertoni/Cambridge/IBM)
                                               Subject: Re: 
XercesDOMWrapperParsedSource memory problem
                      08/07/2003 02:40                                 
                      AM                                               
                      Please respond                                   
                      to xalan-dev                                     
                                                                       



It seems to fix the memory leaking. I haven't checked if the results of
stylesheet transformations are good, bud I suppose they will be.
Moreover I found in the manual:


-- CUT --
XalanDocument * XercesParserLiaison::createDocument ( ... )

Create a XalanDocument proxy for an existing Xerces document.

The parser liaison owns the instance, and you must not delete it. The
liaison will delete it when reset() is called, or the liaison is
destroyed.
-- CUT --

probably this was the piece I was missing. Maybe it should be noted
somewhere near XercesDOMWrapperParsedSource too ?

Thank you a lot for your help

             Vladimir



> This looks like a bug in XercesParserLiaison.  Try modifying your code as
> follows, to see if that clears up the problem:
>
>          while (1) {
>                  process (doc, theParserLiaison, theDOMSupport);
>                  theParserLiaison.reset();
>          }
>
> Dave
>
>
>
>
>                       Dmitry Hayes
>                       <[EMAIL PROTECTED]         To:
[EMAIL PROTECTED]
>                       com>                     cc:      (bcc: David N
Bertoni/Cambridge/IBM)
>                                                Subject: Re:
XercesDOMWrapperParsedSource memory problem
>                       08/06/2003 08:20
>                       AM
>                       Please respond
>                       to xalan-dev
>
>
>
>
>
>
>
>
> It's sounds like a problem.
> Can you please verify if it's a real memory leak and create a bug report
in
> the bugzilla ?
> Thanks
> Dmitry
>
>
>
>                       Vladimir Marek
>
>                       <[EMAIL PROTECTED]        To:
> [EMAIL PROTECTED]
>                       cz>                      cc:
>
>                                                Subject:  Re:
> XercesDOMWrapperParsedSource memory problem
>                       06/08/2003 09:16
>
>                       AM
>
>                       Please respond to
>
>                       xalan-dev
>
>
>
>
>
>
>
> Hello Dmitry,
>
> I'm afraid that XMLPlatformUtils::Terminate() can be called only once,
> at the end of the program. My problem is that I would like to process
> many (thousands) xml files in one program run by one stylesheet, and
> that would need to free the memory more often. I was probably unclear in
> my question, I'm sorry.
>
> Vladimir
>
> > Hello Vladimir!
> > Try to call
> >
> > XMLPlatformUtils::Terminate();
> >
> > in the end of your program
> > Dmitry
> >
> >
> >
> >
> >                       Vladimir Marek
> >                       <[EMAIL PROTECTED]        To:
> [EMAIL PROTECTED]
> >                       cz>                      cc:
> >                                                Subject:
> XercesDOMWrapperParsedSource memory problem
> >                       06/08/2003 05:03
> >                       AM
> >                       Please respond to
> >                       xalan-dev
> >
> >
> >
> >
> >
> >
> > Hello,
> >
> > I found that my program is leaking, and after some investigation I
found
> > this minimal testcase:
> >
> > -- CUT --
> > using namespace std;
> >
> > #include <iostream>
> >
> > #include <xercesc/util/PlatformUtils.hpp>
> > #include <xercesc/dom/DOM.hpp>
> >
> > #include <XercesParserLiaison/XercesDOMSupport.hpp>
> > #include <XercesParserLiaison/XercesParserLiaison.hpp>
> > #include <XalanTransformer/XercesDOMWrapperParsedSource.hpp>
> >
> > XALAN_CPP_NAMESPACE_USE
> > XERCES_CPP_NAMESPACE_USE
> >
> > void process(
> >                 DOMDocument *input,
> >                 XercesParserLiaison &theParserLiaison,
> >                 XercesDOMSupport &theDOMSupport)
> > {
> >
> >         XercesDOMWrapperParsedSource parsedSource
> >                 (input, theParserLiaison, theDOMSupport);
> >
> > }
> >
> > int main (int argc, char **argv) {
> >         XMLPlatformUtils::Initialize();
> >
> >         DOMImplementation* impl =
> >                 DOMImplementationRegistry::getDOMImplementation
> >                         (XMLString::transcode("Core"));
> >
> >         DOMDocument* doc =
> >                 impl->createDocument( 0, XMLString::transcode("root"),
> > 0);
> >
> >         XercesDOMSupport theDOMSupport;
> >         XercesParserLiaison theParserLiaison;
> >
> >         while (1) {
> >                 process (doc, theParserLiaison, theDOMSupport);
> >         }
> >
> >         return 0;
> > }
> > -- CUT --
> >
> > Problem is in the function 'process', each construction of
> > XercesDOMWrapperParsedSource takes some memory, but it's never freed.
> > Probably I'm missing something, please could you help me a bit ?
> >
> > PS: I'm not sure if I am at the correct list, if not, would you be so
> > kind and redirect me ?
> >
> > Thank you
> > --
> >              Vladimír Marek
>
>
>
>
----- Konec původní zprávy ----

--
             Vladimír Marek


Reply via email to