What is the maximum heap size that you can allocate on 32-bit Windows for a Java process using -Xmx?
I’m asking because I want to use the ETOPO1 data in OpenMap and the raw binary float file is about 910 MB.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s nothing better than an empirical experiment to answer your question.
I’ve wrote a Java program and run it while specifying the XMX flag (also used XMS=XMX to force the JVM pre-allocate all of the memory).
To further protect against JVM optimizations, I’ve actively allocate X number of 10MB objects.
I run a number of test on a number of JVMs increasing the XMX value together with increasing the number of MB allocated, on a different 32bit operating systems using both Sun and IBM JVMs, here’s a summary of the results:
OS:Windows XP SP2, JVM: Sun 1.6.0_02, Max heap size: 1470 MB
OS: Windows XP SP2, JVM: IBM 1.5, Max heap size: 1810 MB
OS: Windows Server 2003 SE, JVM: IBM 1.5, Max heap size: 1850 MB
OS: Linux 2.6, JVM: IBM 1.5, Max heap size: 2750 MB
Here’s the detailed run attempts together with the allocation class helper source code:
WinXP SP2, SUN JVM:
java -Xms1470m -Xmx1470m Class1 142
...
about to create object 141
object 141 created
C:>java -Xms1480m -Xmx1480m Class1 145
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
WinXP SP2, IBM JVM
c:\ibm\jdk\bin\java.exe -Xms1810m -Xmx1810m Class1 178
...
about to create object 177
object 177 created
C:>c:\ibm\jdk\bin\java.exe -Xms1820m -Xmx1820m Class1 179
JVMJ9VM015W Initialization error for library j9gc23(2): Failed to instantiate he
ap. 1820M requested
Could not create the Java virtual machine.
Win2003 SE, IBM JVM
C:>"C:\IBM\java" -Xms1880m -Xmx1880m
Class1
JVMJ9VM015W Initialization error for library j9gc23(2): Failed to instantiate he
ap. 1880M requested
Could not create the Java virtual machine.
Linux 2.6, IBM JVM
/opt/ibm/java2-i386-50/bin/java -Xms2750m -Xmx2750m Class1 270
[root@myMachine ~]# /opt/ibm/java2-i386-50/bin/java -Xms2800m -Xmx2800m Class1 270
JVMJ9VM015W Initialization error for library j9gc23(2): Failed to instantiate heap. 2800M requested
Could not create the Java virtual machine.
Here’s the code: