3 回答

TA貢獻2012條經驗 獲得超12個贊
看到這里:Java Tool Doc,它說,
-Xmx n
指定內存分配池的最大大小(以字節為單位)。此值必須是1024的倍數大于2MB。附加字母k或K表示千字節,或m或M表示兆字節。默認值為64MB。此值的上限在Solaris 7和Solaris 8 SPARC平臺上約為4000米,在Solaris 2.6和x86平臺上為2000米,減去開銷金額。例子:-Xmx83886080 -Xmx81920k -Xmx80m
因此,簡單來說,您將Java堆內存設置為可用內存最多1024 MB,而不是更多。
請注意,-Xmx和1024m之間沒有空格
如果使用大寫或小寫,則無關緊要。例如:“-Xmx10G”和“-Xmx10g”完全相同。

TA貢獻1794條經驗 獲得超8個贊
C:\java -X
-Xmixed mixed mode execution (default)
-Xint interpreted mode execution only
-Xbootclasspath:<directories and zip/jar files separated by ;>
set search path for bootstrap classes and resources
-Xbootclasspath/a:<directories and zip/jar files separated by ;>
append to end of bootstrap class path
-Xbootclasspath/p:<directories and zip/jar files separated by ;>
prepend in front of bootstrap class path
-Xnoclassgc disable class garbage collection
-Xincgc enable incremental garbage collection
-Xloggc:<file> log GC status to a file with time stamps
-Xbatch disable background compilation
-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size
-Xss<size> set java thread stack size
-Xprof output cpu profiling data
-Xfuture enable strictest checks, anticipating future default
-Xrs reduce use of OS signals by Java/VM (see documentation)
-Xcheck:jni perform additional checks for JNI functions
-Xshare:off do not attempt to use shared class data
-Xshare:auto use shared class data if possible (default)
-Xshare:on require using shared class data, otherwise fail.
The -X options are non-standard and subject to change without notice.

TA貢獻1934條經驗 獲得超2個贊
-Xmx選項更改VM的最大堆空間。java -Xmx1024m表示VM最多可以分配1024 MB。通俗地說,這意味著應用程序最多可以使用1024MB內存。
添加回答
舉報