From: Pierce on
Hi,
Does anybody know how to free up the memory taken up by a figure after it is closed?

For example I start off with enough memory when matlab starts

memory
Maximum possible array: 1208 MB (1.267e+009 bytes) *
Memory available for all arrays: 1540 MB (1.615e+009 bytes) **
Memory used by MATLAB: 313 MB (3.281e+008 bytes)
Physical Memory (RAM): 3062 MB (3.211e+009 bytes)

Then i generate some variables and plots and the memory is reduced

memory
Maximum possible array: 544 MB (5.700e+008 bytes) *
Memory available for all arrays: 1095 MB (1.148e+009 bytes) **
Memory used by MATLAB: 724 MB (7.592e+008 bytes)
Physical Memory (RAM): 3062 MB (3.211e+009 bytes)

Now i want do some stuff that requires more space than max array size of 544MB.
So i close all figures and delete all variables. But i am still limited by contiguous virtual address space available. How do i return to my inital address space without haiving to close and reopen matlab???

memory
Maximum possible array: 544 MB (5.700e+008 bytes) *
Memory available for all arrays: 1171 MB (1.227e+009 bytes) **
Memory used by MATLAB: 630 MB (6.608e+008 bytes)
Physical Memory (RAM): 3062 MB (3.211e+009 bytes)
From: us on
"Pierce " <pierce.brady(a)cit.ie> wrote in message <i3ucgk$9dm$1(a)fred.mathworks.com>...
> Hi,
> Does anybody know how to free up the memory taken up by a figure after it is closed?
>
> For example I start off with enough memory when matlab starts
>
> memory
> Maximum possible array: 1208 MB (1.267e+009 bytes) *
> Memory available for all arrays: 1540 MB (1.615e+009 bytes) **
> Memory used by MATLAB: 313 MB (3.281e+008 bytes)
> Physical Memory (RAM): 3062 MB (3.211e+009 bytes)
>
> Then i generate some variables and plots and the memory is reduced
>
> memory
> Maximum possible array: 544 MB (5.700e+008 bytes) *
> Memory available for all arrays: 1095 MB (1.148e+009 bytes) **
> Memory used by MATLAB: 724 MB (7.592e+008 bytes)
> Physical Memory (RAM): 3062 MB (3.211e+009 bytes)
>
> Now i want do some stuff that requires more space than max array size of 544MB.
> So i close all figures and delete all variables. But i am still limited by contiguous virtual address space available. How do i return to my inital address space without haiving to close and reopen matlab???
>
> memory
> Maximum possible array: 544 MB (5.700e+008 bytes) *
> Memory available for all arrays: 1171 MB (1.227e+009 bytes) **
> Memory used by MATLAB: 630 MB (6.608e+008 bytes)
> Physical Memory (RAM): 3062 MB (3.211e+009 bytes)

no need to ponder and ruminate on these values...
they are completely(!) meaningless, useless, and nothing but a placebo-like anti-depressant given in homeopathic doses offered by TMW after years and years of complaints that the good old MEMORY command didn't do anything...
in brief: forget it...

us
From: Walter Roberson on
Pierce wrote:
> Hi, Does anybody know how to free up the memory taken up by a figure
> after it is closed?

pack() -- but it must be executed from the command line outside of any function.

If you need to use pack() then you probably should take another approach. For
example, you might consider allocating the large variable _before_ doing the
plots, as the plots and associated variables would be happy in the smaller
contiguous spaces.
From: Jan Houska on
Hi,

Pierce wrote:
> Hi, Does anybody know how to free up the memory taken up by a figure
> after it is closed?
>
> <snip>
>
> Now i want do some stuff that requires more space than max array size of
> 544MB.
> So i close all figures and delete all variables. But i am still limited
> by contiguous virtual address space available. How do i return to my
> inital address space without haiving to close and reopen matlab???

switch to 64-bit version of MATLAB if possible. You will not need to
care about such issues anymore, there's plenty of 64-bit virtual address
space.

Jan


--
Jan Houska HUMUSOFT s.r.o.
houska(a)humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
From: Pierce on
'pack' doesn't do anything to change the contingiuos memory. It just tries to place all the variable beside each other in memory.

Switching to the 64-bit isn't really an option for me.

Anyways i found the answer, Its not possible.

http://www.mathworks.com/support/tech-notes/1100/1106.html

It seems the only solution is to 'save', 'quit' & 'load'

Which is annoying cause i don't like having to restart matlab