insufficient memory for Java Runtime Environment to continue

13 views (last 30 days)
Hi, I am running R2015a on Debian on a cluster that I am "ssh -X" into. I have Matlab set to use software OpenGL. When I try to run Matlab by doing "matlab &", the splash screen shows, then the Matlab window flashes for a split second and then I get
  1. There is insufficient memory for the Java Runtime Environment to continue.
  2. pthread_getattr_np
  3. An error report file with more information is saved as:
  4. /home/daveliu/hs_error_pid17847.log
I tried going on this page: http://www.mathworks.com/help/matlab/matlab_prog/resolving-out-of-memory-errors.html But it doesn't help because it's assuming that Java is crashing because you have too many objects in Matlab. In contrast, Java is crashing for me upon STARTUP of matlab.
Interestingly, it looks like there's something wrong with my Java. First, I need to confirm which java my matlab is using. To do this, I did "matlab -nodesktop" and quickly did "version -java" before matlab crashed after about 2s and here's what it says.
Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot™ 64-Bit Server VM mixed mode
This appears to be the version of Java installed by matlab, since when I do
"/usr/local/MATLAB/R2015a/sys/java/jre/glnxa64/jre/bin/java -XX:MaxHeapSize=1024m -version", it says java version "1.7.0_60" Java™ SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot™ 64-Bit Server VM (build 24.60-b09, mixed mode)
Note that I have to add the -XX:MaxHeapSize=1024 because if I don't, then it gives Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.
On the other hand, if I instead run the default java installed on my system, using "java -XX:MaxHeapSize=1024m -version", then it shows: java version "1.7.0_79" OpenJDK Runtime Environment (IcedTea 2.5.5) (7u79-2.5.5-1~deb8u1) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
So I'm assuming this means that both the java used by matlab (1.7.0_60) and the default java installed on my system (1.7.0_79) requires that I manually supply the maxheapsize or else it will crash by default. So then I looked up how to change the heap size for Java used in Matlab. Unfortunately, most answers and pages from Google say I must open Matlab to do this, which doesn't help because I can only do "matlab -nojvm" at the moment, since opening matlab in the normal manner crashes (which is the entire point of this thread).
and I followed the instructions by adding a java.opts file to /usr/local/MATLAB/R2015a/bin/glnxa64, with the contents -Xmx1024m -Xms256m
And then I ran matlab again, but got the same error message. Anyone know what the deal is? Also before anyone suggest me to open Matlab and check the java version from inside matlab, or change the java heap size from inside Matlab, recall that right now I can only do "matlab -nojvm" and then run fine, or "matlab -nodesktop" but crash in 1-2 seconds.
Any help would be appreciated; thanks

Answers (1)

David
David on 18 Sep 2015
Okay, we managed to fix the issue by doing
"ulimit -v unlimited"
which is done every time we log in. Alternatively, we can also comment out the line
"ulimit -Sv ..."
in /etc/profile, which is a more permanent solution.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!