Reputation: 26387
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?
Upvotes: 3
Views: 3824
Reputation: 1171
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.
Upvotes: 5
Reputation: 25381
Is this a 64 bit VM? If so, you should be able to use the switch as you did.
Upvotes: 1