Question:
Which JVM option is used when there are duplicates
Answer:
In general, it's usually the latter option that gets used if the jvm doesn't reject it. I'm not sure if it is documented anywhere.
Your best bet is to see what happens with your specific JVM, via Runtime's totalMemory and maxMemory:
Code:
public class HeapSize { public static final void main(String[] args) { Runtime rt = Runtime.getRuntime(); System.out.println("Total currently: " + rt.totalMemory()); System.out.println("Max: " + rt.maxMemory()); } }
Output:
$ java HeapSize Total currently: 94896128 Max: 1407713280 $ java -Xmx64m HeapSize Total currently: 64487424 Max: 64487424 $ java -Xmx64m -Xmx512m HeapSize Total currently: 94896128 Max: 477102080 $ java -Xmx512m -Xmx64m HeapSize Total currently: 64487424 Max: 64487424