1. 程式人生 > >java 虛擬機器引數 -xms -xmx

java 虛擬機器引數 -xms -xmx

-Xms 初始化對記憶體大小

為了更好的效能把 -Xms  與-Xms 設為一樣

如果不設定該值,那麼預設根據你執行的模式來決定

-server mode: 系統25%的實體記憶體,最大不超過64m,最小8m

-clientmode: 系統25%的實體記憶體,最大不超過16m,最小8m

如果設定了 -Xns 預設的xms 會被擴大到至少是-Xns的兩倍

-Xmx 最大堆記憶體

如果不設定該值,那麼預設的值根據平臺和的系統的記憶體來決定,具體如下:

Release Platform Default Maximum Heap Size
R27.2 and older Windows
75% of total physical memory up to 1 GB
R27.2 and older Linux, Solaris 50% of available physical memory up to 1 GB
R27.3 and newer Windows on a 64 bit platform 75% of total physical memory up to 2 GB
R27.3 and newer Linux or Solaris on a 64 bit platform 50% of available physical memory up to 2 GB
R72.3 and newer Windows on a 32 bit platform 75% of total physical memory up to 1 GB
R27.3 and newer Linux on a 32 bit platform 50% of available physical memory up to 1 GB

注:-Xmx 必須大於或等於 -xms

    -Xmx 必須大於或等於 -xns

   -Xmx 最小為16mb