max heap memory size is a jvm level setting that the xslt task has no control 
over. The only way to specify a different heap memory size for the xslt task is 
to run it in a different jvm, Running the xslt task by setting the fork 
attribute to true as you showed in the second approach is the way to go. What 
is wrong with this approach?



________________________________
 From: Mark Giffin <m1...@earthlink.net>
To: Ant Users List <user@ant.apache.org> 
Sent: Sunday, August 5, 2012 5:53 PM
Subject: Increase Java heap within xslt task?
 
How can I increase the memory for the xslt task from within Ant 1.8.4, not with 
an environment variable? I am using Saxon by specifying the Saxon jar classpath 
in this target:

  <target name="commands">
    <xslt in="command-spreadsheet.xml" out="out.xml"
      style="intermed.xsl" force="true">
      <classpath location="${saxon}" />
    </xslt>
  </target>

This transform job crashes with "java.lang.OutOfMemoryError: Java heap space" 
unless I set ANT_OPTS=-Xmx256m. But I don't want to have to depend on an env 
variable. Is there a way to increase JVM heap space within the xslt task? I can 
run this same transform successfully with the java task like this, using the 
maxmemory attribute to increase the heap space:

  <target name="old">
    <java jar="${saxon}" fork="true" failonerror="true" maxmemory="256m">
      <!-- Source file -->
      <arg value="-s:command-spreadsheet.xml"/>
      <!-- XSLT stylesheet -->
      <arg value="-xsl:intermed.xsl"/>
    </java>
  </target>

There is no maxmemory attribute for the xslt task. I would rather use the xslt 
task if I can.

Thanks,
Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to