This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Java Heap Memory Preferences

You can adjust the amount of memory that MATLAB® allocates for Java® objects.


The default heap size is sufficient for most cases.

To adjust the Java heap size:

  1. On the Home tab, in the Environment section, click Preferences. Select MATLAB > General > Java Heap Memory.

  2. Select a Java heap size value using the slider or spin box.


    Increasing the Java heap size decreases the amount of memory available for storing data in arrays.

  3. Click OK.

  4. Restart MATLAB.

If the amount of memory you specified is not available upon restart, then MATLAB resets the value to the default, and displays an error dialog box. To readjust the value, repeat the previous steps.

If increasing the heap size does not eliminate memory errors, then check your Java code for memory leaks. Eliminate references to objects that are no longer useful. For more information, see the Java SE Troubleshooting guide at