简体   繁体   中英

'Could not reserve enough space for object heap' when running java -version

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?

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

As I discovered when I had a similar problem (though with a lot less memory on the system -- see Cannot run a 64-bit JVM in 64-bit Windows 7 with a large heap size ), on Windows the JVM will try to allocate a contiguous block of memory.

So my bet is that while you have enough total memory, you don't have enough contiguous memory.

At least to see java version run java -Xmx64m -version this should show you the version if needed. Then you can try increasing Xmx and see at what value it fails

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