Cannot increase Java Heap Space despite lots of RAM available
6 views (last 30 days)
Show older comments
Hello
I'm processing large amounts of brain imaging data and getting this error:
Java exception occurred: java.lang.OutOfMemoryError: Java heap space
I've tried many strategies to increase the Java head space, as suggested here: https://uk.mathworks.com/matlabcentral/answers/92813-how-do-i-increase-the-heap-space-for-the-java-vm-in-matlab-6-0-r12-and-later-versions
However, even after changing the heap space to 2Gb, or to 4Gb (I have a total of 16Gb RAM) via Matlab preferences, and restarting Matlab, when I query the amount of heap space in the command window (using java.lang.Runtime.getRuntime.maxMemory/1e9) I always get "0.9846", no matter what I set the heap space to in Preferences. Why is this? I presume this is the source of my problem.
I've tried this in both versions 2016a and 2014a installed on my workstation.
Many thanks Chris
2 Comments
Jordan Ross
on 21 Sep 2016
Hi Christopher,
When you open up the preferences after restarting does it show the heap value you set it to? Or does it show 984.6MB?
Also make sure that you are pressing "Apply" after you modify the Java Heap size in the preferences menu.
Lastly, try closing all other applications and see if your max memory increases.
Answers (0)
See Also
Categories
Find more on Subplots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!