MATLAB Answers

AA
1

close and restart matlab ? or another way out?

Asked by AA
on 6 Feb 2018
Latest activity Commented on by Jan
on 12 Jun 2019
Hello,
I have a code that is quite computationally and memory-wise intensive and given the RAM(64Gb) I have, I can utilize it for my purpose and get my work done. My code does some kind of optimization, so I need to run my code again, but even after upon performing these operations
clear all;
close all;
pack;
I observe that MATLAB does not release the RAM fully, and only upon restarting, it does. I have some idea that this is a known problem with MATLAB, but I am just curious, has there been any new development that can help? I have R2017a running on Ubuntu16.04
Secondly, I am OK with re-starting and launching a new session, but running these commands
system('matlab &');
exit;
does not help. I see a startup screen, but there is no new window. Also, removing the '&' from above launches a new window but the previous one remains and the RAM is not freed.
Can anyone please help me with this?

  1 Comment

The question is older, but perhaps someone is interested: Starting a new Matlab session should work with the shown command. Without the "&" the system command does not return before the called process is finished.
How do you observe that Matlab uses some memory? There might be some locked M functions or mlock'ed Mex functions. And even if the operating system displays, that Matlab "uses" some memory, this does not necessarily mean, that this memory cannot be used for processing. This could be e.g. a cache from the last disk access - I'm not sure if this is displayed as belonging to the process or to the operating system. Such "occupied" memory is free'd immediately, if it is needed again.

Sign in to comment.

0 Answers