How is the default max Java heap size determined?

前端 未结 10 1834
旧巷少年郎
旧巷少年郎 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:18

    Java 8 takes more than 1/64th of your physical memory for your Xmssize (Minimum HeapSize) and less than 1/4th of your physical memory for your -Xmxsize (Maximum HeapSize).

    You can check the default Java heap size by:

    In Windows:

    java -XX:+PrintFlagsFinal -version | findstr /i "HeapSize PermSize ThreadStackSize"
    

    In Linux:

    java -XX:+PrintFlagsFinal -version | grep -iE 'HeapSize|PermSize|ThreadStackSize'
    

    What system configuration settings influence the default value?

    The machine's physical memory & Java version.

提交回复
热议问题