简体   繁体   中英

Unable to set Java heap size larger than 1568

I am running a server with the following attributes:

Windows Server 2008 R2 Standard - 64bit 4gb RAM

I am trying to set the heap size to 3gb for an application. I am using the flags -Xmx3G -Xms3G. Running with the flags results in the following error:

Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.

I have been playing with the setting to see what my ceiling is and found that 1568 is my ceiling. What am I missing?

How much physical memory is available on your system (out of the original 4 GB)? It sounds like your system doesn't have 3GB of physical memory available when the vm starts up.

Remember that the JVM needs more memory than is allocated to the heap -- there are other data structures as well (thread stacks, etc) that also need memory. So the settings you are providing attempt to use more than 3GB of memory.

Also, are you using a 64-bit jvm? The practical limit for heap size on a 32-bit vm is 1.4 to 1.6 gigabytes according to this document .

Java requires continuous virtual memory on startup. On windows, 32-bit application run in an 32-bit emulated environment so you don't get much more continuous memory than you would in a 32-bit OS. cf on Solaris you get over 3 GB virtual memory for 32-bit Java.

I suggest you use the 64-bit version of Java as this will make use of all the memory you have. You still need to have free memory but the larger address space doesn't suffer from fragmentation.

BTW: The heap space is only part of the memory used, you need memory for shared libraries, direct memory, GUI components etc.

It seems you don't have 3G of physical mememory available. Here is an interesting article on Java heap size settings errors. Java heap size setting errors

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