You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Vasudevan Comandur <vc...@gmail.com> on 2010/01/29 17:54:32 UTC

Clarification on Xerces 2.9.1 version

Hi,

   I am using Xerces 2.9.1 java version. I construct the DOM tree using DOM
Parser and access the nodes for information extraction.

   After completing the processing, I want to clear the root element. Is
there any API calls/methods which I can use to clear that?

   I am using XERCES API in the following sequence.

   1. parser = New DOMParser
   2. parser.parse(InputSource)
   3. Document = parser.getDocument
   4. parser.reset
   5. Element = Document.getDocumentElement

   Then use other methods to extract information from nodes. After that I am
terminating the application. Is there any API like RemoveElement
   which can remove the allocated memory?

   We were profiling the application using NetBeans profiler and found out
that are memory leaks with some of the Xerces classes.

    For Example: I see lot of references to
org.apache.xerces.dom.DeferredDocumentImp,
org.apache.xerces.dom.DeferredElementNSImpl, and
                         org.apache.xerces.dom.DeferredTextImpl.

    Is there a way by which I can get rid of these memory leaks?.

   Looking forward to your reply.

THanks in advance

 Vasu

Re: Clarification on Xerces 2.9.1 version

Posted by Mukul Gandhi <mu...@apache.org>.
On Fri, Jan 29, 2010 at 10:24 PM, Vasudevan Comandur
<vc...@gmail.com> wrote:
>    We were profiling the application using NetBeans profiler and found out
> that are memory leaks with some of the Xerces classes.
>
>     For Example: I see lot of references to
> org.apache.xerces.dom.DeferredDocumentImp,
> org.apache.xerces.dom.DeferredElementNSImpl, and
>                          org.apache.xerces.dom.DeferredTextImpl.
>
>     Is there a way by which I can get rid of these memory leaks?.

Xerces is a framework on which we build XML applications, and there is
generally no way to optimize the memory management which goes within a
framework, by the client code. And the same is true with Xerces as
well.

To optimize memory usage, you need to look opportunities within the
client code itself.

If you could post some actual code fragments you've written, probably
somebody might suggest API usage optimizations.

I am also curious to know, how big a DOM structure you are trying to
produce (for e.g, if you'll serialize it, how much big a XML document
will be produced)? What is the size of physical memory of the box,
where you are running this program?


-- 
Regards,
Mukul Gandhi

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