0

I am running a java app on a Windows 10 machine via

JAVA -Xms1500M -Xmx1600M -jar appname.jar

The app fails after a while with an error stating not enough heap space. When it is running using Task Manager I can see I am using about 50% of the total memory available on the machine.

If I try and increase the -Xmx space then I get an error saying it cannot be allocated - why is this as there is plenty of memory free?

The Java app is a 3rd party and I know it runs on colleagues pcs

enter image description here

My JVM version is

enter image description here

5
  • How much RAM do you have? Are you running a 32 bit JVM? What does java -version print out. Commented Dec 7, 2019 at 15:00
  • I am on a 64bit machine with 12Gb memory Commented Dec 7, 2019 at 15:02
  • Java version info has been added to the question Commented Dec 7, 2019 at 15:02
  • With 32 bit you'd have a 4GB limit Commented Dec 7, 2019 at 15:22
  • @gurioso - In practice, on Windows it is about 1.6GB. See the link in my answer. Commented Dec 7, 2019 at 15:32

1 Answer 1

1

I suspect that you are running a 32 bit JVM. (According to the version info you have an Oracle release, and Java 8 was the last versin that Oracle provided 32 bit downloadables for.)

Assuming that is the case, the max heap size for a 32 bit Java on Windows is limited to between 1.4 and 1.6GB. The limit is a result of the way that Windows allocates virtual address spaces. For more details read:

The solution is to download and install a 64 bit Java release for Windows. You want a download for the "x86-64" architecture.

(I notice that you are running 1.8.0_101. That was released in July 2016 and is way out of date. At time of writing, the most recent Java 8 release is 1.8.0_231.)


The Java app is a 3rd party and I know it runs on colleagues pcs

They probably have installed 64 bit Java.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks - that was the issue I was running a 32 bit version. Removed it and added 64 bit version. It works fine now.
I used this to find the version I was running stackoverflow.com/questions/8825244/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.