Java Heap Space on a Mac

4 views (last 30 days)
T.R.
T.R. on 26 Aug 2011
Hello,
I want to increase the amount of java heap space in Matlab. On my Linux machine with 16GB of RAM, I can go to "File -> Preferences -> Java Heap Memory" and I can set the heap up to 4 GB. However, on a Mac with 8GB of RAM, the preferences menu limits me to 256 MB. I have tried this in Matlab 2010a and 2011b.
Does anyone know how I can set the heap greater than 256 MB on a Mac?
Thanks in advance, T.R.

Answers (1)

the cyclist
the cyclist on 30 Aug 2011
I believe you can use the method outlined in this solution:
The first part of that solution describes how to do it as you describe, via the Preferences menu. However, just after that, it describes how to edit the "java.opts" file to increase the maximum heap size. Look for the Mac-specific part for finding the file.
You'll want to read some the caveats there about choosing a large heap size (as it effectively takes away workspace memory). I found solution by tracing from this blog post, which you might also find interesting:
In the end, you should be able to see if it worked by using the command:
>> max = java.lang.Runtime.getRuntime.maxMemory
I'd be interested to know if this works for you, so please let me know how it goes.

Community Treasure Hunt

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

Start Hunting!