ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Giffin <m1...@earthlink.net>
Subject Re: Increase Java heap within xslt task?
Date Mon, 06 Aug 2012 21:40:31 GMT
Thanks Vimil, that's a good tip.

Mark

On 8/5/2012 8:00 PM, Vimil Saju wrote:
> You can use macrodefs to make it more readable to others.
>
> First define a macrodef something like as follows
>
>
> <macrodef name="forked-xslt">
> <attribute name="in"/>
> <attribute name="out/>
> <attribute name="style"/>
> <sequential>
>   <java jar="${saxon}" fork="true" failonerror="true" maxmemory="256m">
>          <arg value="-s:@{in}"/>
> <!-- XSLT stylesheet -->
>         <arg value="@{style}"/>
>       </java>
> </sequential>
> </macrodef>
>
>
> Now you can invoke the macrodef as follows
>
> <forked-xslt in="command-spreadsheet.xml" out="out.xml" style="intermed.xsl"/>
>
>
> ________________________________
>   From: Mark Giffin <m1879@earthlink.net>
> To: Ant Users List <user@ant.apache.org>
> Cc: Vimil Saju <vimilsaju@yahoo.com>
> Sent: Sunday, August 5, 2012 7:20 PM
> Subject: Re: Increase Java heap within xslt task?
>   
> I assume you mean running the java task with the fork attribute set to
> true, not the xslt task. Nothing is wrong with using the java task, but
> I thought it might be a little easier for someone else to understand if
> I used the xslt task instead. But this seems like more trouble than it
> is worth.
>
> Thanks for your help!
>
> On 8/5/2012 7:02 PM, Vimil Saju wrote:
>> 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 <m1879@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-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message