0

My system reports 8Gb, but when I try and reserve 6.5Gb heap space, or even 4Gb for a java program it fails. Is this because I installed the 32-bit version?

Fails to allocate heap java -Xmx3072m -jar {...}

Starts ok, but app runs out of memory. java -Xmx2048m -jar {...}

1
  • 1
    This screams trolling. No you can't address an infinite amount of ram. There are tricks to use more than 2, 3, 3.5, or 4 depending...Java just doesn't do it. And yes, it's probably related to 32-bit. Mar 1, 2012 at 17:43

1 Answer 1

0

Believe it or not, this is a frequently asked question. So your answer is here:

"The maximum theoretical heap limit for the 32-bit JVM is 4G. Due to various additional constraints such as available swap, kernel address space usage, memory fragmentation, and VM overhead, in practice the limit can be much lower. On most modern 32-bit Windows systems the maximum heap size will range from 1.4G to 1.6G. On 32-bit Solaris kernels the address space is limited to 2G. On 64-bit operating systems running the 32-bit VM, the max heap size can be higher, approaching 4G on many Solaris systems.

As of Java SE 6, the Windows /3GB boot.ini feature is not supported.

If your application requires a very large heap you should use a 64-bit VM on a version of the operating system that supports 64-bit applications. See Java SE Supported System Configurations for details. "

1
  • Switching to 64-bit works. It may seem obvious but there are a lot of posts saying 32-bit will get you there so it is a safe bet. Nobody mentions that 64-bit can do things you cannot do with 32-bit. I guess I am also a really bad programmer... I keep a 32GB machine in the garage when I need it but I need to unplug the dryer to use it and it's getting old and slow.
    – Grok
    Mar 1, 2012 at 19:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .