Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum heap space constraints in java

Tags:

java

jvm

I have a program that needs a lot of memory and want to set the maximum heap space at 6024MB. Java gives me the error:

Invalid maximum heap size: -Xmx6024m
The specified size exceeds the maximum representable size.

Is there a workaround?

like image 847
Christian Avatar asked Feb 19 '26 05:02

Christian


2 Answers

There are big differences between how many heap one can allocate between the different Java VMs. E.g. Sun's VM needs to allocate the memory as a single block from the OS. This limitation does not exist for Oracle's JRockit VM. It is also OS dependent -- e.g. I was able to allocate more heap with Sun's VM using Linux than was possible with Windows XP. Also note that I read somewhere that the problem goes away for 64bit OSes...

Edit:

Here's a blog entry about Sun's JVM and Java heap space issues on 32bit Windows OSes.

like image 166
Frank Grimm Avatar answered Feb 21 '26 17:02

Frank Grimm


Is this a 64 bit VM? If so, you should be able to use the switch as you did.

like image 31
Thomas Lötzer Avatar answered Feb 21 '26 17:02

Thomas Lötzer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!