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 "Houle, Dennis W" <De...@West.Boeing.com> on 2001/10/01 23:39:50 UTC

RE: Possible memory leak in IDOM_Element::getElementsByTagName()? ???

Rich,
I can respond to your IDOM memory questions as an IDOM user, not a developer
of the IDOM API.  My understanding is that the IDOM_Document manages the
memory needs of its nodes/elements.  That is why you never delete pointers
returned from IDOM operations (e.g. getAttribute, item, getFirstChild, etc.)
All of the memory used by an IDOM_Document and its nodes/elements is
released when you are finished with the IDOM_Document and delete its
pointer.

Also, be sure you are using a recent release, the folowing
IDDeepNodeListImpl bug was fixed in early August:
 * Revision 1.5  2001/08/07 17:01:09  tng
 * [Bug 2676] IDOM: pure virtual called in IDDeepNodeListImpl::item() .

Any clarifications or corrections from an IDOM developer would be most
welcome!
- Dennis

-----Original Message-----
From: Christy, Rich [mailto:Rich.Christy@citadelgroup.com]
Sent: Monday, October 01, 2001 9:43 AM
To: 'xerces-c-dev@xml.apache.org'
Subject: Possible memory leak in
IDOM_Element::getElementsByTagName()????


I trying to determine if this is a problem or not.  But each time I call
getElementsByTagName(), it works its way down to
IDDeepNodeListImpl::getDeepNodeList() where memory is allocated to and
inserted into the node list pool.  Purify claims a memory leak is occurring.
I cannot find any where in the logic where IDDeepNodeListPool::removeAll()
is called.  Am I just missing something or is this a bug.  I've added a call
to XMLPlatformUtils::Terminate(), but that doesn't seem to make a
difference.

thanks

Rich Christy
rich.christy@citadelgroup.com



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

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


Re: Possible memory leak in IDOM_Element::getElementsByTagName()????

Posted by Tinny Ng <tn...@ca.ibm.com>.
If you manually create a DOM document in memory, e.g.
        IDOM_Document*   myDocument =
IDOM_DOMImplementation::getImplementation()->createDocument();
        delete myDocument;
then you need to explicitly delete the document object.

But if you just retrieve the document object after parsing an instance document,
e.g.
        IDOMParser *parser = new IDOMParser;
        parser->parse(gXmlFile);
        IDOM_Document *doc = parser->getDocument();
        delete parser;

memory will be automatically taken care of by the IDOM parser when the
IDOMParser is deleted.

Tinny

"Houle, Dennis W" wrote:

> Rich,
> I can respond to your IDOM memory questions as an IDOM user, not a developer
> of the IDOM API.  My understanding is that the IDOM_Document manages the
> memory needs of its nodes/elements.  That is why you never delete pointers
> returned from IDOM operations (e.g. getAttribute, item, getFirstChild, etc.)
> All of the memory used by an IDOM_Document and its nodes/elements is
> released when you are finished with the IDOM_Document and delete its
> pointer.
>
> Also, be sure you are using a recent release, the folowing
> IDDeepNodeListImpl bug was fixed in early August:
>  * Revision 1.5  2001/08/07 17:01:09  tng
>  * [Bug 2676] IDOM: pure virtual called in IDDeepNodeListImpl::item() .
>
> Any clarifications or corrections from an IDOM developer would be most
> welcome!
> - Dennis
>
> -----Original Message-----
> From: Christy, Rich [mailto:Rich.Christy@citadelgroup.com]
> Sent: Monday, October 01, 2001 9:43 AM
> To: 'xerces-c-dev@xml.apache.org'
> Subject: Possible memory leak in
> IDOM_Element::getElementsByTagName()????
>
> I trying to determine if this is a problem or not.  But each time I call
> getElementsByTagName(), it works its way down to
> IDDeepNodeListImpl::getDeepNodeList() where memory is allocated to and
> inserted into the node list pool.  Purify claims a memory leak is occurring.
> I cannot find any where in the logic where IDDeepNodeListPool::removeAll()
> is called.  Am I just missing something or is this a bug.  I've added a call
> to XMLPlatformUtils::Terminate(), but that doesn't seem to make a
> difference.
>
> thanks
>
> Rich Christy
> rich.christy@citadelgroup.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


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