Hi Jason,
I modified the CreateDOMDocument sample to do the following (modified from
your original posting):

   {
XMLCh xfoo[] = {chLatin_f, chLatin_o, chLatin_o, chNull};
    DOMImplementation* impl =
DOMImplementationRegistry::getDOMImplementation(X("Core"));
   for (int foobar=0; foobar<1000; foobar++)
    {
        try
        {
            DOMDocumentType* dt = impl->createDocumentType(xfoo,xfoo,xfoo);
            dt->release();
        }
        catch (...)
        {
            XERCES_STD_QUALIFIER cerr << "An error occurred creating the
document" << XERCES_STD_QUALIFIER endl;
            errorCode = 3;
        }
    }}

When I run the sample through purify on windows it reports that there is no
memory leak.  How are you determining there is a leak?

I am not using the infinite loop (while (1)) but have tried going up to
100,000...  If there was a problem I thought it would show up by then...

Regards,
David A. Cargill
XML Parser Development


                                                                           
             [EMAIL PROTECTED]                                             
             tics.com (Jason                                               
             E. Stewart)                                                To 
             Sent by: "Jason           [email protected]             
             E. Stewart"                                                cc 
             <[EMAIL PROTECTED]                                             
             atics.com>                                            Subject 
                                       Re: createDocuemntType leaking      
                                                                           
             05/31/2005 01:42                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
                   c-dev                                                   
                                                                           
                                                                           





----- Message from [EMAIL PROTECTED] (Jason E. Stewart) on Sat, 28
May 2005 17:17:10 +0530 -----
                                                                           
            To: [email protected]                                    
                                                                           
       Subject: Re: Using delete() instead of release()                    
                                                                           

Gareth Reakes <[EMAIL PROTECTED]> writes:

> Hey,
>
>            Wrote a short one
>
>
http://blog.parthenoncomputing.com/xerces/archives/2005/05/memory_manageme.html

>
> Please give comments. This comes up now and again so its worth
> spending a bit of time on to make it understandable.

Hey Gareth,

I've re-examined this. Your blog entry says:

  "To release all memory consumed then you must call release on the
  document. If, after calling release the document you still see a
  memory leak then there may well be a memory leak."

My code does the following:
1) gets a DOMImplementation
2) calls createDocumentType()
3) calls createDocument()
4) calls doc->release()

and it leaks memory. Calling delete on the DOMImplementation is
obviously wrong because the call to getDOMImplementation segfaults
next time around.

I don't have anything else to call release() on, do I?

So I've exhausted my ideas. Why is this not a leak?

Cheers,
jas.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to