How is the default max Java heap size determined?
heap-memory, java
Solution
On Windows, you can use the following command to find out the defaults on the system where your applications runs.
java -XX:+PrintFlagsFinal -version | findstr HeapSize
Look for the options `MaxHeapSize` (for `-Xmx`) and `InitialHeapSize` for `-Xms`.
On a Unix/Linux system, you can do
java -XX:+PrintFlagsFinal -version | grep HeapSize
I believe the resulting output is in bytes.
Problem
If I omit the `-Xmxn` option from the Java command line then a default value will be used. According to Java documentation "the default value is chosen at runtime based on system configuration" What system configuration settings influence the default value?