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

Kaan
  • 5,434
  • 3
  • 19
  • 41
BENBUN Coder
  • 4,801
  • 7
  • 52
  • 89

1 Answers1

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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Thanks - that was the issue I was running a 32 bit version. Removed it and added 64 bit version. It works fine now. – BENBUN Coder Dec 07 '19 at 15:49
  • I used this to find the version I was running https://stackoverflow.com/questions/8825244/how-do-i-detect-whether-32-bit-java-is-installed-on-x64-windows-only-looking-at – BENBUN Coder Dec 07 '19 at 15:49