5

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

Pro.Hessam
  • 819
  • 3
  • 11
  • 26
  • try 'which java' to see which java is running? probably it's not running to the right ones? or directly execute java from its bin directory? – Jim Horng Oct 19 '12 at 15:17
  • 2
    Do you have set limits on memory? What kind of linux? RHEL, Fedora? run `$uname -a` and add output to the question. and `$ulimit -a` also will be helpful – user1516873 Oct 22 '12 at 15:05
  • I'm worried about that glibc message... – Shark Oct 24 '12 at 12:06
  • 1
    Try running it as root, if you can then check your ulimit, you may need to increase it. – Chad Campbell Oct 24 '12 at 19:03

5 Answers5

2

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.

Community
  • 1
  • 1
seninp
  • 712
  • 1
  • 6
  • 23
1

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.

Dan
  • 108
  • 5
1

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.

thedayofcondor
  • 3,860
  • 1
  • 19
  • 28
  • java -Xmx3000m -Xms3000m Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Even larger values crash the VM – thedayofcondor Oct 25 '12 at 00:56
0

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.

user18428
  • 1,216
  • 11
  • 17
-1

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.

Anshu
  • 7,783
  • 5
  • 31
  • 41