32-bit JVM on 64-bit Windows crashes on launch with -Xmx1300m and plenty of free memory
Posted
by
Konrad Garus
on Stack Overflow
See other posts from Stack Overflow
or by Konrad Garus
Published on 2013-06-24T16:06:15Z
Indexed on
2013/06/24
16:21 UTC
Read the original article
Hit count: 201
I'm struggling with Java heap space settings. The default Java on Windows is the 32-bit client regardless of OS version (that's what Oracle recommends to all users). It appears to set max heap size to 256 MB by default, and that is too little for me.
I use a custom launcher to start the application. I would like it to use more memory on computers with plenty RAM, and default to -Xmx512m
on those with less RAM. As far as I'm aware, the only way is the static -Xmx
setting (that has to be set on launch).
I have a user who has 8 GB RAM, 64-bit Windows and 32-bit Java 7. Maximum memory visible to the JVM is 4G (as returned by querying OperatingSystemMXBean
). I understand why, no issue.
For some reason my application is unable to start for this user with -Xmx1300m
, even though he has 2.3G free memory. He closed some applications (having 5G free memory), and still it would not launch. The error reported to me was:
error occured during init of vm
could not reserve enough space for object heap
What's going on? Could it be that the 32-bit JVM is only able to address the "first" 4G of memory and has to have a 1300M block available within those first 4 gigabytes?
How can I solve this problem, except for asking everyone to install 64-bit Java (what is unlikely to be acceptable)?
© Stack Overflow or respective owner