From: Sathish Chalasani on
Hi,

I'am working on a project called blade health monitoring which has got a complicated algorithm that works for several units. The problem is:
My memory started off with the following:
memory
Maximum possible array: 514 MB (5.388e+008 bytes) *
Memory available for all arrays: 1377 MB (1.444e+009 bytes) **
Memory used by MATLAB: 319 MB (3.346e+008 bytes)
Physical Memory (RAM): 4095 MB (4.294e+009 bytes)

* Limited by contiguous virtual address space available.
** Limited by virtual address space available.

when i ran my code for 1st unit, the memory readings are(at the end of first unit):
memory
Maximum possible array: 244 MB (2.562e+008 bytes) *
Memory available for all arrays: 1107 MB (1.161e+009 bytes) **
Memory used by MATLAB: 400 MB (4.194e+008 bytes)
Physical Memory (RAM): 4095 MB (4.294e+009 bytes)

* Limited by contiguous virtual address space available.
** Limited by virtual address space available.

when i ran the code for second unit, the memory readings are:
memory
Maximum possible array: 53 MB (5.571e+007 bytes) *
Memory available for all arrays: 689 MB (7.221e+008 bytes) **
Memory used by MATLAB: 475 MB (4.981e+008 bytes)
Physical Memory (RAM): 4095 MB (4.294e+009 bytes)

* Limited by contiguous virtual address space available.
** Limited by virtual address space available.

and when i started the third unit, it gave an error, saying

ERROR DETAILS: 1
Message : Error during identification of events.
Source Dir --> D:\BHM\Sabine\297376\TOAFiles\Temp
Out of memory. Type HELP MEMORY for your options.
Identifier : MATLAB:nomem

when i checked, the memory keeps decreasing even though i clear off all the variables before i start a new unit. is this a memory leakage in matlab? if so how to solve it. if not how do we get over it.
From: Mark Shore on
"Sathish Chalasani" <sathish.chalasani(a)gmail.com> wrote in message <hqhgro$apo$1(a)fred.mathworks.com>...
> Hi,
>
> I'am working on a project called blade health monitoring which has got a complicated algorithm that works for several units. The problem is:
> My memory started off with the following:
> memory
> Maximum possible array: 514 MB (5.388e+008 bytes) *
> Memory available for all arrays: 1377 MB (1.444e+009 bytes) **
> Memory used by MATLAB: 319 MB (3.346e+008 bytes)
> Physical Memory (RAM): 4095 MB (4.294e+009 bytes)
>
> * Limited by contiguous virtual address space available.
> ** Limited by virtual address space available.
>
> when i ran my code for 1st unit, the memory readings are(at the end of first unit):
> memory
> Maximum possible array: 244 MB (2.562e+008 bytes) *
> Memory available for all arrays: 1107 MB (1.161e+009 bytes) **
> Memory used by MATLAB: 400 MB (4.194e+008 bytes)
> Physical Memory (RAM): 4095 MB (4.294e+009 bytes)
>
> * Limited by contiguous virtual address space available.
> ** Limited by virtual address space available.
>
> when i ran the code for second unit, the memory readings are:
> memory
> Maximum possible array: 53 MB (5.571e+007 bytes) *
> Memory available for all arrays: 689 MB (7.221e+008 bytes) **
> Memory used by MATLAB: 475 MB (4.981e+008 bytes)
> Physical Memory (RAM): 4095 MB (4.294e+009 bytes)
>
> * Limited by contiguous virtual address space available.
> ** Limited by virtual address space available.
>
> and when i started the third unit, it gave an error, saying
>
> ERROR DETAILS: 1
> Message : Error during identification of events.
> Source Dir --> D:\BHM\Sabine\297376\TOAFiles\Temp
> Out of memory. Type HELP MEMORY for your options.
> Identifier : MATLAB:nomem
>
> when i checked, the memory keeps decreasing even though i clear off all the variables before i start a new unit. is this a memory leakage in matlab? if so how to solve it. if not how do we get over it.

My own experience has been that clear does not effectively release the allocated memory space used by the cleared arrays. I assume this may be due to non-optimal garbage collection or memory management routines in MATLAB.

Perhaps someone with more experience under the hood could comment. Some possible workarounds are switching to a 64-bit system with more RAM, overwriting old arrays instead of clearing them, or restarting MATLAB (which probably won't help you).