Search code examples
matlabmemoryheap-size

MATLAB wont open after java heap memory change


I changed the Java heap memory from 128 MB to 4096 GB and now MATLAB will not open.

I am using Windows 7 and I have actually had this problem before a long time ago and there was a way I could change the memory back in a file somewhere, but I cannot remember the file name or location.

Someone please help me. I think this is a relatively simple problem. I don't understand why MATLAB wont start after increasing the java heap memory. My system has 16 GB of RAM and this doesn't make sense.

Thanks


Solution

  • The settings file (for R2014b in Windows) lives at:

    %AppData%\MathWorks\MATLAB\R2014b\matlab.prf
    

    For Linux, and presumably also OS X:

    $HOME/.matlab/R2014b/matlab.prf
    

    You may also be able to locate the preferences file more reliably if you can launch MATLAB with the -nojvm option (thanks Amro):

    fullfile(prefdir,'matlab.prf') % if you can get into MATLAB
    

    The setting to look for is (example with 512 MB):

    JavaMemHeapMax=I512
    

    Edit that and start MATLAB. If that doesn't work, backup the whole folder and start again with fresh settings.

    If you have a 32-bit installation of MATLAB, then 4096MB heap size might cause problems. Just a guess.