Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 {...}

share|improve this question
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. – RobotHumans Mar 1 '12 at 17:43
up vote 0 down vote accepted

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. "

share|improve this answer
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 '12 at 19:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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