How can I return simulink memory back to OS?
1 view (last 30 days)
Show older comments
It looks like simulink memory leak. Look following script. (comment memory value from Windows Task Manager)
%matlab start
% 227MB
open_system sf_car
% 358MB
sim sf_car
% 383MB
close_system sf_car
% 386MB
bdclose all
% 386MB
clear
clear all
clear functions
clear classes
clear java
clear global
clear import
clear variables
% 385MB
Even after closing simulink, memory used by MATLAB.exe wasn't decreased. And, when execute simulation, memory was increased slowly.
open_system sf_car
% 355MB
sim sf_car
% 381MB
for i = 1 : 200
sim sf_car
end
% 384
for i = 1 : 200
sim sf_car
end
% 386MB
for i = 1 : 400
sim sf_car
end
% 387MB
I want to return memory increased during simuation back to OS. I tried following command. But It didn't work.
close_system sf_car
close('all', 'hidden');
% 386MB
clear
clear all
clear functions
clear classes
clear java
clear mex
clear global
clear import
clear variables
% 385MB
[m x j] = inmem('-completenames')
for i = 1 : length(m)
if mislocked(m{i})
munlock(m{i})
end
end
clear functions
% 371MB
% decreased a little.. but, after munlock and clear command,
% error message(?) printed during simulation =>
%Error calling slsfnagctlr('NagToken',...)
%A viewer named "DAS" already exists.
%Error calling slsfnagctlr('Clear',...)
%A viewer named "DAS" already exists.
2 Comments
Kaustubha Govind
on 10 Apr 2012
Kyungjoon: I would recommend reporting this to MathWorks Tech Support so the appropriate development team can look into this.
K E
on 10 Apr 2012
If you figure out the answer from Tech Support could you post it here? Am curious.
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!