Java和虚拟内存ulimit

时间:2013-11-11 15:52:05

标签: java java-7 openjdk ulimit

我试图在虚拟内存被ulimit -v 2000000限制为2GB的环境中使用java,但是我遇到了内存错误。在此环境中运行java -version会产生:

$ java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

无论我设置-Xmx有多低,我都无法在这种环境下运行java。但是,如果ulimit -v设置为2.5GB,那么我可以将-Xmx设置为250米,但不能更高。

$ java -Xmx250m -version
java version "1.7.0_19"
OpenJDK Runtime Environment (rhel-2.3.9.1.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

$ java -Xmx251m -version
#
# There is insufficient memory for the Java Runtime Environment to continue.
# pthread_getattr_np
java version "1.7.0_19"
OpenJDK Runtime Environment (rhel-2.3.9.1.el6_4-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)# An error report file with more information is saved as:
# ~/hs_err_pid12079.log

是否可以在使用ulimit限制虚拟内存的环境中使用java?

0 个答案:

没有答案