简体   繁体   中英

How to resolve 'Error occurred during initialization of VM' java?

I've connected to a linux-based server using ssh. Recently, I've installed JDK using following command:

sudo yum install java-1.6.0-openjdk-devel

And jdk installed successfully, but whenever I run command java or javac I get following error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Even, running command java -version , will bring that error. When I try to give java more space using java -Xmx512m -Xms256m -version , I'll get following error:

*** glibc detected *** java: double free or corruption (!prev): 0x00007fc84400e270 ***
*** glibc detected *** java: double free or corruption (fasttop): 0x00007fc8440089f0 ***
#
Aborted (core dumped)

How can I resolve this?

Thanks in advance

I have never seen this sort of exception, so it is my best guess: did you try to limit stack size by using -Xss JVM parameter (ie -Xms8m -Xmx16m -Xss4m)? Also quick googling suggest that export MALLOC_CHECK_=0 could possibly let you get over, but I am not sure if JVM will function well.

A virtual Linux server? What do you get when run:

java -Xmx1m -version

and

ulimit -a

Looks like a memory allocating problem. You can try to increase swap space if possible.

对我来说,似乎没有足够的内存来运行虚拟机(可能是物理内存,虚拟内存或ulimit) - 你应该尝试减少分配给VM的内存(我认为64Mb中的默认值)而不是增加它。

降低你的-Xms(不是xmx)。例如使用-Xms40m。如果它在其他答案中说明,你可能内存太低而无法在启动时回收256m的vm。

Looks like you are using JDK 32-bit version . If so, you cannnot assign a Heap size more than 1.2GB or something.

Either use a 64 bit JDK or try with 1.2G as the max heap size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM