Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] OutOfMemoryError

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: m AT lhaza.com
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] OutOfMemoryError
  • Date: Fri, 20 Jan 2006 09:36:44 -0800

Looks like Gsell Martin is using a streaming NodeFactory, so should be able to process arbitrarily large documents rather than being bounded by a constant limit. Unless his custom NodeFactory code has a hidden memory leak, of course.

Wolfgang.

On Jan 20, 2006, at 8:16 AM, Markus Lindner wrote:

Hello all,

I also encountered OOM-errors using large XML-files (ca. 30 MB), but I
used to set my app like this:

java -Xmx768m -Xms512m -XX:SurvivorRatio=6 -XX:ThreadStackSize=512
-Dfile.encoding="UTF-8" -jar myapp.jar

this way the OOM-error did not rise.
Of course the machine has to have enough RAM to handle this.

cheers,
markus

Hi All,



I have downloaded xom-1.1.jar a few weeks ago and getting more and more
familiar with it. It provides a lot of great features; I ever missed
when using DOM.



One of my requirements is to store the content of very large XML files
in separate files and do some other changes to the XML. Therefore I
programmed my own NodeFactory and use the Builder to process these
files.



If the content is greater than about 50 MB, this fails due to an
OutOfMemoryError. The reason is that 'makeText(String data)' of the
underlying NodeFactory provides the content as String, already. This is
very memory consuming for big contents. To avoid it, I intended to
handle the problem on SAX level and developed a quick and (sofar) dirty
solution by overwriting the XOMHandler. The code to use it is this:



XMLReader parser =
XMLReaderFactory.createXMLReader ("org.apache.xerces.parsers.SAXParser");


Builder builder = new Builder(parser);

parser.setContentHandler(new MyXOMHandler());

Document xmlDoc = builder.build(iInputStream);





Since 'XOMHandler' is package private, I have had to place
'MyXOMHandler' in the package 'nu.xom', either. Even worse, 'Sealed:
true' must be set for the package in the Manifest file of xom-1.1.jar to
get it running. As you can see - quick but dirty.



So I would like to ask, if 'XOMHandler' could be a public class in
future Versions of XOM or any body out there has a better solution for
the problem.



Thanks and best regards,



Martin



--

Martin Gsell

Actinium Consulting GmbH

Dammsteggasse 2

D-88131 Lindau



Bei InnoSysTec:

Tel: +49 (0)7553 9180-331

Fax: +49 (0)7553 9180-349

mailto:martin.gsell AT InnoSysTec.de <mailto:martin.gsell AT InnoSysTec.de>



_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest



--
"0x07: Signature not present. Press any key."


_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest





Archive powered by MHonArc 2.6.24.

Top of Page