How to limit RAM memory usage for compiled matlab executables?

7 次查看(过去 30 天)
I use Matlab 2022b and the corresponding MCR2022b
Even for the following min. example the RAM-memory usage after startup is about 300MB or above. After some time it reduces to a quite lower amount.
Min bspw:
File:
%simple example for memory alloc as executable
j=0;
for jj=1:1e8
j=j+1;
pause(10)
disp(j);
end
Code for console:
mcc('-m', 'my_simple_exe_code.m', '-d', pwd, '-o', 'my_simple_exe_code')
For my real code problem, the numbers of RAM-memory usage are as follows:
After startup as .exe: 400-600MB
After 3h of running of .exe: 30-70MB
Running code in Matlab: 30-70MB of additional RAM-usage.
I already tried to set some additional options for the compiler
opts = compiler.build.StandaloneApplicationOptions([file_name,'.m'],...
'ExecutableName',exe_name,...
'OutputDir' ,deploy_path,...
'SupportPackages',{'none'}...
);
compiler.build.standaloneApplication(opts);
But this does not change anything.
As far is i understood matlab runtime load a number of functions into the memory. After the process is running stable it checks which functions are required at all and reduces the number of loaded functions. Is there a possibility to check the required packages/functions earlier?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by