BENBUN Coder
BENBUN Coder

Reputation: 4881

Java JVM limits for --Xmx

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

Upvotes: 0

Views: 847

Answers (1)

Stephen C
Stephen C

Reputation: 718708

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.

Upvotes: 1

Related Questions