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 Avihai Marchiano <am...@mercado.com> on 2007/01/08 20:54:42 UTC

Memory leak in DomParser

Hey,

 

I am using xerces ver #2.2 and I am using a lot in DomParser.

 

After some time (around 36 hours) I get OutOfMemory.

 

I test my application with JProbe memory debugger and I notice that a
lot of resources (especially String) were not released after parsing was
finished and garbage collector was run.

 

The only related topic that I found is:

http://mail-archives.apache.org/mod_mbox/xerces-j-users/200212.mbox/%3c2
fb0968997d93980d2275a9d36e6e99f@www3.mail.post.cz%3e

But there is no answer.

 

Please, give your advices.

 

Thank you.

 

 

My code is:

             DOMParser parser = new DOMParser();

            XMLParserErrorHandler xmlParserErrorHandler = new
XMLParserErrorHandler();

            parser.setErrorHandler(xmlParserErrorHandler);

 

            parser.setFeature("http://xml.org/sax/features/validation",
true);

 

 
parser.setFeature("http://apache.org/xml/features/validation/schema",
true);

 

            StringBuffer sb = new StringBuffer(SCHEMA_NS_URI);

            sb.append(" ");

            sb.append(new File(SCHEMA_XSD_LOCATION).toURI().toString());

 

 
parser.setProperty("http://apache.org/xml/properties/schema/external-sch
emaLocation",

                              sb.toString());

 

 
parser.setFeature("http://xml.org/sax/features/namespaces",true);

 

 

            m_document  = null;

            parser.parse(new InputSource(new
FileInputStream(schemaFile)));

            m_document = parser.getDocument();


RE: Memory leak in DomParser

Posted by Avihai Marchiano <am...@mercado.com>.
I check it also in 2.9, and the problem still exists.


-----Original Message-----
From: Michael Glavassevich [mailto:mrglavas@ca.ibm.com] 
Sent: Monday, January 08, 2007 10:50 PM
To: j-users@xerces.apache.org
Subject: Re: Memory leak in DomParser

Is there something preventing you from moving to a more recent release 
(like 2.9)? Xerces-J 2.2 is over four years old now. We've fixed
hundreds 
of bugs since then. Several of the fixes were for memory leaks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Avihai Marchiano" <am...@mercado.com> wrote on 01/08/2007 02:54:42

PM:

> Hey,
> 
> I am using xerces ver #2.2 and I am using a lot in DomParser.
> 
> After some time (around 36 hours) I get OutOfMemory.
> 
> I test my application with JProbe memory debugger and I notice that 
> a lot of resources (especially String) were not released after 
> parsing was finished and garbage collector was run.
> 
> The only related topic that I found is:
> http://mail-archives.apache.org/mod_mbox/xerces-j-users/200212.
> mbox/%3c2fb0968997d93980d2275a9d36e6e99f@www3.mail.post.cz%3e
> But there is no answer.
> 
> Please, give your advices.
> 
> Thank you.
> 
> 
> My code is:
>              DOMParser parser = new DOMParser();
>             XMLParserErrorHandler xmlParserErrorHandler = new 
> XMLParserErrorHandler();
>             parser.setErrorHandler(xmlParserErrorHandler);
> 
>
parser.setFeature("http://xml.org/sax/features/validation", 
true);
> 
>             parser.setFeature("http://apache.
> org/xml/features/validation/schema", true);
> 
>             StringBuffer sb = new StringBuffer(SCHEMA_NS_URI);
>             sb.append(" ");
>             sb.append(new
File(SCHEMA_XSD_LOCATION).toURI().toString());
> 
>             parser.setProperty("http://apache.
> org/xml/properties/schema/external-schemaLocation",
>                               sb.toString());
> 
>             parser.setFeature("http://xml.org/sax/features/namespaces
",true);
> 
> 
>             m_document  = null;
>             parser.parse(new InputSource(new 
FileInputStream(schemaFile)));
>             m_document = parser.getDocument();

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



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


Re: Memory leak in DomParser

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Is there something preventing you from moving to a more recent release 
(like 2.9)? Xerces-J 2.2 is over four years old now. We've fixed hundreds 
of bugs since then. Several of the fixes were for memory leaks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

"Avihai Marchiano" <am...@mercado.com> wrote on 01/08/2007 02:54:42 
PM:

> Hey,
> 
> I am using xerces ver #2.2 and I am using a lot in DomParser.
> 
> After some time (around 36 hours) I get OutOfMemory.
> 
> I test my application with JProbe memory debugger and I notice that 
> a lot of resources (especially String) were not released after 
> parsing was finished and garbage collector was run.
> 
> The only related topic that I found is:
> http://mail-archives.apache.org/mod_mbox/xerces-j-users/200212.
> mbox/%3c2fb0968997d93980d2275a9d36e6e99f@www3.mail.post.cz%3e
> But there is no answer.
> 
> Please, give your advices.
> 
> Thank you.
> 
> 
> My code is:
>              DOMParser parser = new DOMParser();
>             XMLParserErrorHandler xmlParserErrorHandler = new 
> XMLParserErrorHandler();
>             parser.setErrorHandler(xmlParserErrorHandler);
> 
>             parser.setFeature("http://xml.org/sax/features/validation", 
true);
> 
>             parser.setFeature("http://apache.
> org/xml/features/validation/schema", true);
> 
>             StringBuffer sb = new StringBuffer(SCHEMA_NS_URI);
>             sb.append(" ");
>             sb.append(new File(SCHEMA_XSD_LOCATION).toURI().toString());
> 
>             parser.setProperty("http://apache.
> org/xml/properties/schema/external-schemaLocation",
>                               sb.toString());
> 
>             parser.setFeature("http://xml.org/sax/features/namespaces
",true);
> 
> 
>             m_document  = null;
>             parser.parse(new InputSource(new 
FileInputStream(schemaFile)));
>             m_document = parser.getDocument();

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