Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 29th, 2008, 09:41 AM
Registered User
 
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Memory Error:using saxon with option java -Xmx1024

Hi All,


I am trying to transform a 572 MB input.xml using a transform.xsl on Sun Solaris system(having more than 10 GB memory) in which I have used below for-each-group three times:

<xsl:for-each-group select="School/student" group-by="name/tokenize(., ';\s*')">
  <xsl:sort select="current-grouping-key()"/>
  <name count="{count(current-group())}">
    <xsl:value-of select="current-grouping-key()"/>
  </name>
</xsl:for-each-group>
I am using saxon9.0.0.3 processor for same. I tried it with this command-

java -jar saxon/saxon9.jar -o ./output_xml ./input_xml transform.xsl

and got following error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Now I tried the same with this command-

java –Xmx1024m -jar saxon/saxon9.jar -o ./output_xml ./input_xml transform.xsl

and again got the same error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

Can I use any other command to resolve this error or Saxon cannot handle the 572 MB size of file? Is there any other processor which I can use?

Please help me.

Thanks,
Manish


 
Old January 29th, 2008, 09:51 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I normally recommend allocating memory equal to five times the input document size - but you sometimes need more, sometimes less.

With Saxon-SA there are techniques for reducing the memory required: see

http://www.saxonica.com/documentatio...cs/serial.html

and

http://www.saxonica.com/documentatio...rojection.html

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old January 29th, 2008, 09:51 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

You might be missing a switch there I think (don't know if this will fix your problem). The -s switch is (I think) needed before the input.xml.

java -jar saxon/saxon9.jar -o output_xml -s input_xml transform.xsl

/- Sam Judson : Wrox Technical Editor -/
 
Old January 29th, 2008, 10:22 AM
Registered User
 
Join Date: Jan 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Michael and Sam for your quick reply.

I used the command below:
java -Xmx3870m -jar saxon/saxon9.jar -o ./output_xml -s ./input_xml transform.xsl
and got this error:

Exception in thread "main" java.lang.OutOfMemoryError
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:203)
        at java.util.jar.JarFile.<init>(JarFile.java:132)
        at java.util.jar.JarFile.<init>(JarFile.java:70)
        at sun.misc.URLClassPath$JarLoader.getJarFile(URLClas sPath.java:579)
        at sun.misc.URLClassPath$JarLoader.<init>(URLClassPat h.java:546)
        at sun.misc.URLClassPath$3.run(URLClassPath.java:324)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.misc.URLClassPath.getLoader(URLClassPath.java: 313)
        at sun.misc.URLClassPath.getLoader(URLClassPath.java: 290)
        at sun.misc.URLClassPath.getResource(URLClassPath.jav a:160)
        at java.net.URLClassLoader$1.run(URLClassLoader.java: 192)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
        at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)


then I tried with this command-
java -Xmx3500m -jar saxon/saxon9.jar -o ./output_xml -s ./input_xml transform.xsl

and got same previous error:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

I don't know much about Saxon-SA,so I am going through the links suggested by Michael. Hope it will work for me.

Manish


 
Old January 29th, 2008, 12:08 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Is it possible to construct smaller data files with the same structure? Try doing something smaller and see how the memory requirement increases with data size.

Your stack trace surprises me rather:

Exception in thread "main" java.lang.OutOfMemoryError
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:203)
        at java.util.jar.JarFile.<init>(JarFile.java:132)
        at java.util.jar.JarFile.<init>(JarFile.java:70)
        at sun.misc.URLClassPath$JarLoader.getJarFile(URLClas sPath.java:579)

because it's loading software at the time of the error. Usually you'll get an OutOfMemory error while building the tree representing the source document, which will show a very different kind of stack trace. That's not necessarily significant, just a bit odd.

Have you tried running with -t on the Saxon command line to see how far it gets before it fails?

Also, try running a trivial (identity) transform on the same source document. That should tell you whether the problem is in loading the source document into memory, or whether it's something that your stylesheet is doing (like creating huge amounts of temporary data in working storage).



Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Jumping into java extensions to Saxon mphare XSLT 2 April 29th, 2008 10:02 PM
XSLT not executing java function(using SAXON) dved XSLT 2 January 15th, 2008 08:46 PM
Saxon java question amhicraig XSLT 1 December 7th, 2007 01:21 PM
error on saxon 8.8 rjonk XSLT 1 October 24th, 2006 09:03 AM
calling saxon from java program Tomi XSLT 1 July 31st, 2006 06:57 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.