Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java heap size problem in MATLAB

I am trying to run a java program through MATLAB. When my input file is a small size, it works fine. But when I increase the file size, and in turn increase my heap size I get this error message:

Error occurred during initialization of VM

Could not reserve enough space for object heap

Could not create the Java virtual machine.

When I run my java command with -Xmx1500m it works fine, but when I increase it to -Xmx2000m it gives the error message. The computer I'm on has 12 GB of memory, so I don't see why increasing my heap size to 2000 should be a problem. I don't have any memory clogging programs running.

like image 383
thepro22 Avatar asked Aug 29 '11 18:08

thepro22


1 Answers

It appears you are using a 32-bit JVM. Java requires a single block of continuous memory for its heap and depending on the OS this is limited to 1.2 to 1.6 GB depending on your OS regardless of the amount of memory you have.

If you use a 64-bit JVM you don't have this problem.

like image 73
Peter Lawrey Avatar answered Oct 05 '22 12:10

Peter Lawrey