Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
why does Matlab fail to release memory even if I clear all the variables?

Subject: why does Matlab fail to release memory even if I clear all the variables?

From: Ha

Date: 1 Mar, 2010 13:47:05

Message: 1 of 2

The program occupies increasing memory storage and the computer becomes slower and slower... finally, the error of "out of memory" happens. However, during the running of the program, no new variable is created. Why does the program needs an increasing memory?

Possibly, I think, this may be caused during calling 'myfcn' in a nested loop. So, I test it with some simple codes: for n=1:10000, p=myfcn(C,ph); end. That veritified my judgement. BTW, function 'myfcn' is the only function involving symblic operation.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [pzs] = myfcn(C, ph)
syms pz
ph = real(ph);
P = [ph,pz; -pz,ph];
CM = P * C * P.';
eq = det(CM-eye(2));
cc = sym2poly(eq);
pzs = roots(cc);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Another problem I'm confusing is that even after I clear all the variables by executing "clear", the memory are not released.

Subject: why does Matlab fail to release memory even if I clear all the variables?

From: us

Date: 1 Mar, 2010 14:01:05

Message: 2 of 2

"Ha "
> Another problem I'm confusing is that even after I clear all the variables by executing "clear", the memory are not released.

it is...
- download this great utility (in case you run a wintel sys)...

http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

% start ML, then
% open PROCESS EXPLORER, select ML, select the -performance graph- tab
% then
     m=rand(10000);
% watch -private bytes- in the graph...
     clear m;
% watch, again...

us

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us