Tuesday, February 8, 2011

increasing java heap size in build file

I recently had to increase the java heap size for running my program. This did not seem obvious in the first few hits from google


<target name="run" depends="compile">
<java fork="true" classname="your.class.name">
<classpath>
<path refid="classpath" />
<path location="${dist}/parallelImpl.jar" />
</classpath>
<jvmarg line="-Xms256m -Xmx3000m" />
</java>
</target>

This specifies a minimum size of 256 MB and a maximum size of 3000MB.

A good article about java memory management

http://java.sun.com/j2se/reference/whitepapers/memorymanagement_whitepaper.pdf

No comments:

Post a Comment