How is the default max Java heap size determined?

前端 未结 10 1860
旧巷少年郎
旧巷少年郎 2020-11-22 03:50

If I omit the -Xmxn option from the Java command line then a default value will be used. According to Java documentation

\"the default v

10条回答
  •  我寻月下人不归
    2020-11-22 04:29

    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.

提交回复
热议问题