How do I increase the heap space for the Java VM in MATLAB?
古いコメントを表示
How do I increase the heap space for the Java VM in MATLAB?
採用された回答
その他の回答 (1 件)
Igor Varfolomeev
2015 年 6 月 19 日
編集済み: MathWorks Support Team
2025 年 6 月 20 日
Although the Answer by MathWorks Support Team is correct for old matlab versions, here's a cople of notes, concerning more recent versions:
-------
1. First of all, now "Max Java Heap Memory" parameter could be changed via a slider in Preferences->Matlab->General->Java Heap Memory
2. If the maximum value, allowed by this slider, is too small for your needs, (e.g. R2014b only allows me to set it to 49GB, while physically I have 192GB), it could be directly adjusted by editing
"c:\Users\%USERNAME%\AppData\Roaming\MathWorks\MATLAB\R2014b\matlab.prf"
3. Open it with a text editor and modify "JavaMemHeapMax" value. It should look like
JavaMemHeapMax=I190000
4. Restart Matlab
-------
Notes:
- Since this preferences file is in your AppData folder, you even don't need administrative permissions (in contrast to adding "java.opts" to $MATLABROOT, as discussed in the mentioned answer.
- To check the actual value, used by Matlab (in GB):
>> java.lang.Runtime.getRuntime.maxMemory/1e9
- Preferences UI works OK with this new value (thanks, Mathwoks!). It just displays a warning, that it is larger, then recommended.
4 件のコメント
K E
2016 年 2 月 15 日
編集済み: MathWorks Support Team
2021 年 6 月 24 日
Here is how to find out your machine's max heap size (returns values in bytes while JavaMemHeapMax looks for value in MB). Should I use this value for the Matlab preference above? Why did you enter JavaMemHeapMax=I190000 when you said you had 192GB? Even after I entered my max value of 4GB and it 'took' in Matlab, exporting a figure from the figure window Edit button causes Matlab to freeze for several minutes then issue the error 'Insufficient Java memory to create the output. Increase the Java Heap Size setting in the MATLAB preferences.' I am plotting 2052075 points within the figure. Is 4GB too low to copy that? Didn't see this problem until R2015b.
Namita Vishnubhotla
2016 年 4 月 22 日
編集済み: MathWorks Support Team
2023 年 4 月 27 日
It is possible that the output requires more than 4GB. If you were able to successfully execute the same code in previous versions of MATLAB, using the same amount of Heap Space, please contact MathWorks Technical Support with valid license number: https://www.mathworks.com/support/contact_us.html?s_tid=contact_us_support_cust_serv
Vandana Ravichandran
2017 年 2 月 22 日
編集済み: Vandana Ravichandran
2017 年 2 月 22 日
This page from R2016b documentation describes how to set the Java heap space: https://www.mathworks.com/help/matlab/matlab_external/java-heap-memory-preferences.html
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!