Pro.Hessam
Pro.Hessam

Reputation: 829

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

Upvotes: 6

Views: 20573

Answers (5)

user18428
user18428

Reputation: 1201

Lower your -Xms (not xmx).Use -Xms40m for example.If it starts as it is stated in other answers, you may be too low on memory to reclaim 256m for the vm at start.

Upvotes: 0

seninp
seninp

Reputation: 742

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 (i.e. -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.

Upvotes: 2

thedayofcondor
thedayofcondor

Reputation: 3876

To me it looks like there is not enough memory to run the virtual machine (maybe physical memory, virtual memory or ulimit) - you should try decreasing the memory allocated to the VM (I think the default in 64Mb) and not increasing it.

Upvotes: 1

Dan
Dan

Reputation: 108

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.

Upvotes: 1

Anshu
Anshu

Reputation: 7853

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.

Upvotes: -1

Related Questions