Maximum heap space constraints in java
I have a program that needs a lot of memory and want to set th开发者_开发技巧e 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?
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.
Is this a 64 bit VM? If so, you should be able to use the switch as you did.
精彩评论