Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Following error happens if I call java or javac:

Error occurred during initialization of VM
Could not reserve enough space for object heap
# An unexpected error has been detected by Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0xb7dee4da, pid=9915, tid=3084225424
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode linux-x86)
# Problematic frame:
# C  []  cfree+0x7a
# An error report file with more information is saved as:
# /root/hs_err_pid9915.log
# If you would like to submit a bug report, please visit:

As far as I read, the problem is supposed to be that java tries to allocate a continuous chunk of memory, and this doesn't work in some virtual environments (Xen, openVZ and others).

Is there a solution for this problem?

share|improve this question
up vote 1 down vote accepted

Java works fine in Xen -- I'm running a big Solr instance on a Xen VM right now. It also works on OpenVZ (been there, done that), although it does require some tweaking due to OpenVZ's "interesting" allocation limits model. Basically, whatever you're reading, it's massively and completely wrong.

Things to check include:

  • Do you have any swap configured? You might want some of that, and it's easy to accidentally have no swap in a paravirt VM.
  • Is /proc/sys/vm/overcommit_memory set to 2? That will prevent overcommit from working, which is the core of what Java is trying to do.
  • Is the VM just underprovisioned for what you're telling Java to allocate? If it's running a pile of other stuff, and there isn't enough memory, Java can still bomb if you tell it to use a monster amount of heap.
share|improve this answer
This is good advice. I tried to create a swap file and I somehow crashed the machine. After that I convinced my hosting company to adjust my quotas, and now it works. So I don't know if one of your recommendations would have helped, but I accept them anyway. – Mauli Oct 14 '09 at 8:50

Java certainly works on Xen. It might be that you don't have enough physical(+swap) memory to start the JVM. Xen domains tend to be constrained by the amount of memory they have. 128MB or 256MB is fairly common for commercial VPS providers. The JVM uses two parameters to set the initial size and maximum size of the heap. These are -Xms and -Xmx respectively. IIRC the default for -Xmx is (or at least was) 64M. If -Xms is configured, the JVM will attempt to allocate that much memory at startup. It's a common trick to set both values to the same value to stop memory fragmentation. Setting -Xms to a value higher than you physically have available would probably cause you some problem. I would try creating a simple Hello World java program and see if you can run something like:

# java -Xms=32M -Xmx=32M HelloWorld

and see if that works. Try reducing the values lower if it doesn't work; raise it if it does. Hopefully you can discover how much memory you can use.

share|improve this answer
I tried those already, it didn't help. – Mauli Oct 14 '09 at 8:51
Good grief, who's still providing 128MB VPSes? – womble Oct 15 '09 at 6:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.