java -Xmx1024m filename
-Xmx
是什么意思?
java -Xmx1024m filename
-Xmx
是什么意思?
请看这里:Java工具文档,它说:
-Xmxn
指定内存分配池的最大大小(以字节为单位)。该值必须是大于2MB的1024的倍数。附加字母k或K表示千字节,m或M表示兆字节。默认值为64MB。在Solaris 7和Solaris 8 SPARC平台上,此值的上限将约为4000m,在Solaris 2.6和x86平台上将为2000m,减去开销金额。例如:所以,简单来说,你将Java堆内存设置为最大1024 MB可用内存,不多也不少。-Xmx83886080 -Xmx81920k -Xmx80m
请注意,-Xmx和1024m之间没有空格。
使用大小写不重要。例如:" -Xmx10G" 和 " -Xmx10g" 效果完全一样。
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.
-Xmx选项更改了VM的最大堆空间。java -Xmx1024m意味着VM可以分配最多1024 MB的内存。通俗地说,这意味着该应用程序最多可以使用1024MB的内存。
该应用程序的最大堆使用量为1024 MB。
-Xmx
设置最大堆大小。