C:\Users\Admin>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
-Xdiag show additional diagnostic messages
-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.
-XshowSettings show all settings and continue
-XshowSettings:all show all settings and continue
-XshowSettings:vm show all vm related settings and continue
-XshowSettings:properties show all property settings and continue
-XshowSettings:locale show all locale related settings and continue
The -X options are non-standard and subject to change without notice.
4 回答
运行命令
java -X
,您将获得所有-X
选项的列表:The -X options are non-standard and subject to change without notice.
我希望这将有助于您了解Xms,Xmx以及其他更重要的事情 . :)
标志
Xmx
指定Java虚拟机(JVM)的最大内存分配池,而Xms
指定初始内存分配池 .这意味着您的JVM将以
Xms
内存量启动,并且最多可以使用Xmx
内存量 . 例如,启动如下所示的JVM将启动256 MB内存,并允许进程使用最多2048 MB的内存:内存标志也可以指定多种大小,例如千字节,兆字节等 .
Xms
标志没有默认值,Xmx
的默认值通常为256 MB . 这些标志的常见用途是遇到java.lang.OutOfMemoryError
.使用这些设置时,请记住这些设置是针对JVM的堆的,并且JVM可以/将使用的内存多于分配给堆的大小 . 从Oracle's documentation:
您可以在IDE中指定它 . 例如,对于运行配置中的Eclipse→VM参数 . 输入
-Xmx800m -Xms500m
:该问题的主要部分已在上文讨论过 . 只需添加部分默认值 .
根据http://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html
Xmx的默认值取决于系统中可用的平台和内存量 .