Take the following build.xml
snippet:
<target name="run">
<java
jar="${server-jar}"
fork="true"
failonerror="true"
maxmemory="1g">
<jvmarg line="${env.JVM_ARGS}"/>
</java>
</target>
What does the maxmemory
flag exactly do? Does it set the heap memory initial/max size? I get heap errors and trying to understand if this flag is enough, or I must set -Xmx
and -Xms
separately in JVM_ARGS
.
The documentation of maxmemory in ant java target is vague to me:
maxmemory: Max amount of memory to allocate to the forked JVM, ignored if fork is false
According to the JavaDoc for the Java
task class:
Corresponds to -mx or -Xmx depending on VM version.
In the source code, it is referenced here.
And, yes, Xmx
is the setting for the heap:
Specifies the maximum size (in bytes) of the heap.
(You may see a bit more info about some of the other Ant <java>
task settings, too, in the Javadoc.)