Java – ‘Could not reserve enough space for object heap’ when running java -version

javamemoryvirtual-memorywindows-server-2008

I know this is a common question/problem. I'm wondering where to get started with it.

Running java on windows server 2008, we have 65GB memory, and it shows 25GB free. (Currently a couple of guys are running processes).

systeminfo | grep -i memory

shows:

Total Physical Memory: 65, 536 MB
Available Physical Memory: 26,512MB
Virtual Memory: Max Size 69,630 MB
Virtual Memory: Available 299 MB
Virtual Memory: In Use: 69, 331 MB. 

Really just wondering how I go about solving this problem.

  • Where do I start?
  • What does it mean that more virtual memory is being
    used than physical memory, and is this why java won't start?
  • Does
    java want to use virtual memory rather than physical memory?

java -version

gives me:

Error occured during initialization of VM
could not reserve enough space for object heap

More specific questions:

  • Why doesn't the JVM want to use the free phsyical memory?
  • How much memory does a java command (like java -version) want to use if you don't specify Xms parameters?
  • Would simply assigning more virtual memory be a good solution to the problem?

Best Answer

I got the same issue. From the analysis, we found that the machine have low swap space. Please increase the swap space and verify.