How to limit RAM memory usage for compiled matlab executables?
16 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!