Java Heap Memory on Mac OS X

3 views (last 30 days)
Chris
Chris on 28 Feb 2013
The highest I can set it to on my Mac is 256MB, while on a 64-bit Windows machine it is ~1500MB. Is there a reason for this and/or a way around it?

Answers (1)

Shashank Prasanna
Shashank Prasanna on 28 Feb 2013
I think the limit is a 1/4 of your total RAM or memory. Are you referring to the same machine? Your windows machine probably has 6gb of ram while mac has 1gb of ram.
You can increase beyond that by manually editing the java.opts file, but it is not recommended.
  5 Comments
Shashank Prasanna
Shashank Prasanna on 25 Jul 2013
I did some digging and it seems that the limit on mac correct. The workaround to change it beyond that is to edit the java.opts file.
There is info on how to go about doing this in the following solutions page:
Ryan
Ryan on 24 Sep 2013
The instructions at http://www.mathworks.com/support/solutions/en/data/1-18I2C/ are either insufficient, incorrect, or I am missing something.
I am running Mac OS 10.8 with 32 GB of memory and I am using MATLAB 2013a.
version -java
gives:
Java 1.6.0_51-b11-457-11M4509 with Apple Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
I noticed that I cannot increase the Java Heap Memory in the Preferences GUI in MATLAB so I followed the instructions at http://www.mathworks.com/support/solutions/en/data/1-18I2C/ and:
1. Created a file using TextEdit.app with one line:
-Xmx7000m
(The instructions gave the example of entering the line -Xmx256m into the java.opts file to increase the max java heap memory to 256 MB. I entered -Xmx7000m to have roughly 7 GB -- which is well under the limit of one quarter of your total memory which, for me, is 0.25*TotalMemory = 0.25*32 GB = 8 GB.)
2. I saved the file as java.opts and chose to "use .opts" file extension when prompted by the Mac OS.
3. I dragged this file from my desktop into the MATLAB_2013a package and entered my password to approve the changes.
4. I restarted the computer and MATLAB.
Still, when I execute
java.lang.Runtime.getRuntime.maxMemory
from the command line I get the same as I did before adding the java.opts file:
200409088
(about 191 MB).
Can anyone provide more accurate instructions or provide a solution that works?
Thank you very much,
Ryan

Sign in to comment.

Categories

Find more on Startup and Shutdown 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!