Java与虚拟内存ulimit
我试图在虚拟内存被ulimit-v200000限制为2GB的环境中使用java,但是我得到了内存错误。在此环境中运行Java与虚拟内存ulimit,java,java-7,openjdk,ulimit,Java,Java 7,Openjdk,Ulimit,我试图在虚拟内存被ulimit-v200000限制为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 ex
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
设置为250m,但不能更高
$ 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?这是所有可用JVM(oracle或openjdk,版本6,7,8)中众所周知的巨大错误。报道如下: 不幸的是,没有Java开发人员的解决方案。
解决方案:拼命使用各种java选项或停止使用java和基于java的应用程序:-(看起来系统已经消耗了大部分可用内存,Java没有喘息的空间。当你提供更多的喘息空间时,它开始工作的事实证明了这一点。是的,这是可能的,但不是当你没有实际可用的资源时。这不是问题。
top
显示了超过7GB的可用RAM,我可以n运行分配内存高达2GB的python和C/C++程序。是否确实使用了ulimit-v200000
而不是ulimit-v200000
?