I have a web start application that can run in 1GB of memory, but it runs quite a bit faster for certain tasks if it has 4GB of memory. So I want to use 4GB when I can... i.e., on 64-bit JVMs.
Is it possible to do this? Is there a way in the JNLP file to specify the max heap for 32-bit JVMs and 64-bit JVMs separately?
Update
I tried a JNLP file with these lines:
<resources>
<j2se version="1.8+" java-vm-args="-XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError"/>
</resources>
<resources os="Windows" arch="x86">
<j2se href="http://java.sun.com/products/autodl/j2se" onclick="javascript:mytracker(this.href);" version="1.8+"
max-heap-size="1024m"/>
</resources>
<resources os="Windows" arch="x86_64">
<j2se href="http://java.sun.com/products/autodl/j2se" onclick="javascript:mytracker(this.href);" version="1.8+"
max-heap-size="4096m"/>
</resources>
It did not work. Other lines in the architecture specific resources blocks did work, so I know the resources blocks with the "arch" attribute are correctly identified and used. I removed those other lines in this post for brevity.
Yes, you can give different max heap sizes based on the architecture. Here's an example:
<resources os="Windows" arch="x86">
<j2se href="http://java.sun.com/products/autodl/j2se" onclick="javascript:mytracker(this.href);" version="1.8+"
max-heap-size="1024m"/>
</resources>
<resources os="Windows" arch="x86_64">
<j2se href="http://java.sun.com/products/autodl/j2se" onclick="javascript:mytracker(this.href);" version="1.8+"
max-heap-size="4096m"/>
</resources>
Notice the difference between the above example and the one given in the question! The first resources tag in the question's example has been removed. This is crucial, as the Java web start launcher will only recognize the first j2se tag that matches the/a installed JVM. Since, in the question's example, the first j2se tag matches, it is used and the arguments specified in it are used... and not the arguments in subsequent j2se tags.