MATLAB Answers

Increasing Java Heap Memory of target machine so that EXE runs on target machine with MCR

22 ビュー (過去 30 日間)
Purnendu Nath
Purnendu Nath 2019 年 9 月 26 日
回答済み: Purnendu Nath 2019 年 9 月 27 日
This helps with increasing Java Heap Memory on the developer machine
If I have a target machine that has only the MCR intalled... which hangs because of "" how do I increase the Java Heap Memory relevant for Matlab EXE on that machine? What should I tell the user on Windows 10 to do? Will increasing it using the "Control Panel - Programs - Java" be good enough? (i.e. http://www.messiahpsychoanalyst.org/wikihow/index.php/How_to_Increase_Java_Memory_in_Windows)
Or is there some way to specifically increase it for Matlab based EXE that run on the MCR?

  3 件のコメント

Guillaume
Guillaume 2019 年 9 月 26 日
Why do you want to increase the Java Heap Memory (which would decrease the memory available to matlab to store non-java stuff such as matrices)?
Purnendu Nath
Purnendu Nath 2019 年 9 月 26 日
Because when my (appdesigner) app crashes after doing (say 1010) simulations for no apparent reason (e.g. if I restart it at 1009 it continues again) the red error message in the command window includes the following:
java.lang.OutOfMemoryError: Java heap space
Guillaume
Guillaume 2019 年 9 月 26 日
In tha case, then indeed incresing the java heap may help. However, it would be interesting to find what is exhausting the java memory. appdesigner apps don't rely on java as far as I know.
If you can attach your app code, so we can look into it. Or raise a bug with Mathworks if your license allows it.

サインイン to comment.

採用された回答

Bruno Luong
Bruno Luong 2019 年 9 月 26 日
編集済み: Bruno Luong 2019 年 9 月 26 日
According to my test, the stand alone app uses the sames amount of java heap memory than your MATLAB preferences.
To set the amount of Java heap memory you can either uses the menu in the toolstrip
Menu Preferences -> General - Java Heap Memory
or edit the file prefernce file
>> edit(fullfile(prefdir,'matlab.prf'));
the put desired amount of the memory in Mb in the line (here 1Gb)
JavaMemHeapMax=I1024
Then compile your app
On Windows platform if you want to change the Heap after compilation. Run the app once then close it. then goes the folder
C:\Users\XXX\AppData\Local\Temp\XXX\mcrCacheM.N\APPNAME_YYY\.matlab
where XXX is the user name, M.N, APPNAME depends on your MCR version and application name, edit the line
JavaMemHeapMax=I1024
then relauch your app.

  2 件のコメント

Purnendu Nath
Purnendu Nath 2019 年 9 月 27 日
Having set it, is there a command line (or shell command) that I can use to inspect what value it has been set at without opening the .prf file? I would like to be able to click a button on my stand alone app and get a message that tells me what the JavaMemHeapMax setting is on machine running the stand alone app.
Bruno Luong
Bruno Luong 2019 年 9 月 27 日
Use this (at the start of your application)
fprintf('Java memory = %d Mb\n', round(java.lang.Runtime.getRuntime.maxMemory/1e6));

サインイン to comment.

その他の回答 (1 件)

Purnendu Nath
Purnendu Nath 2019 年 9 月 27 日
Bruno, all of the above has worked perfectly...
Thanks a lot!

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。


Translated by