how to specify java heap size on cluster?

39 views (last 30 days)
gtg733w on 18 Aug 2016
Commented: Martin Lechner on 21 Jun 2023
I am trying to run matlab on a cluster. I need to increase the java heap size in matlab, but since it's a cluster, I can't use the GUI method to do this. Is there a command line flag to specify the java heap size on start-up? Something like matlab -nosplash - Xmx.... Or, is there a start-up options file on the cluster that I can edit? I have read about editing the java.opts file or the startup.m file, but it seems like these would not be allowed on a cluster.

Answers (1)

Abel Szkalisity
Abel Szkalisity on 6 Feb 2021
But honeslty, to me none of the answers suggested there solved my problem (namely to increase the java-heap size on the cluster).
It turned out (at least the experience shows), that the environment variable _JAVA_OPTIONS is overriding the settings both in java.opts and in the matlab.prf file. On linux try sg like:
export _JAVA_OPTIONS=-Xmx2048m
in your command line before starting matlab to increase the heap space. This worked for me on R2019a in a linux cluster.
Martin Lechner
Martin Lechner on 21 Jun 2023
This solution works perfectly for my standalone Matlab applications on Linux calculation clusters.

Sign in to comment.


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


Community Treasure Hunt

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

Start Hunting!