1回复
4年前
JVM最大能使用多少内存
看到一篇文章说,系统进程内存最大限制,32位和64位理论上最大都可达到4G,这个最大限制可以测试,用类似于下面命令:
java -Xmx503446m -version
如果不报错,说明能分配500G左右
我试了一下,
$ java -Xmx603446m -version
Java HotSpot(TM) 64-Bit Server VM warning: INFO:
os::commit_memory(0x00007e6915650000, 19773718528, 0) failed;
error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment
to continue.
# Native memory allocation (mmap) failed to map 19773718528
bytes for committing reserved memory.
$ java -Xmx503446m -version
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
可见500G左右没问题,600G就不行了,但是这个远超4G了?
3380 阅读