This is 64-bit Windows 7 Enterprise and 64-bit Java 7:
java version "1.7.0_04" Java(TM) SE Runtime Environment (build 1.7.0_04-b20) Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
This happens using a shell like C:\Windows\SystemWOW64\cmd.exe (which I incorrectly thought was the 64-bit version) and with C:\Windows\System32\cmd.exe (which I just found out, kindly provided by Pulsar, 64 bit application, despite the path name).
The program itself is trivial:
public class Trivial { public static void main(String[] args) { System.out.println("total = " + toMB(Runtime.getRuntime().totalMemory())); System.out.println("max = " + toMB(Runtime.getRuntime().maxMemory())); } private static long toMB(long bytes) { return bytes / (1024L * 1024L); } }
I simply cheated on the different arguments -Xmx and -Xms to see what happens. I would like, although with 64-bit Java on 64-bit Windows, I could use almost any max size and the initial heap I wanted, but that is not what happens.
java -Xmx16G -Xms2G Trivial (for example) is working fine. However, java -Xmx16G -Xms4G Trivial gives me:
Error occurred during initialization of VM Could not reserve enough space for object heap
Weirder (for me), java -Xmx16G -Xms3G Trivial gives another error:
Error occurred during initialization of VM Unable to allocate tables for parallel garbage collection for the requested heap size. Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
Trying to split the difference between 2G and 3G to see if the specific size was where it happened, I tried java -Xmx16G -Xms2900M Trivial and it worked. Then I tried -Xms2960M and it worked. With -Xms2970m JVM crashed:
#
This continued until -Xms2995M , when he again switched to the message "tables could not be allocated for parallel garbage collection" and stuck with it as -Xms .
What could be? Does anything from cmd.exe (even 64-bit) run any process size limits? Does Windows (or JVM) require one huge block of memory? (But then why different messages)? Something else?
java memory-management windows 64bit
Quantummechanic
source share