3

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?

3
  • As Thomas Lötzer pointed out, the problem could be that you're trying to do this in a 32 bit environment. If that's not the case, please tell us a bit about your JVM and OS environment! Apr 6, 2010 at 9:29
  • Yes, unfortunately I seem to be working in a 32 bit enviroment :(
    – Christian
    Apr 6, 2010 at 9:39
  • ok. how much of RAM does the box have (and that you can use) and are there any other boxes whose RAM you can use? Apr 6, 2010 at 10:35

2 Answers 2

5

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.

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.