|
"Steven Lord" <slord@mathworks.com> wrote in message <gl4mn2$2jm$1@fred.mathworks.com>...
>
> "Theodor Zouk" <rebet4@hotmail.com> wrote in message
> news:gl4ffm$9u3$1@fred.mathworks.com...
> > Hi
> > I have three questions:
> > 1) Is there a way to see how much memory it takes to plot variables in
> > matlab?
>
> No.
>
> > For example i have the variables:
> >
> > y = rand(1,40000000);
> > x= 0:1/(40000000-1):1;
> > plot(x,y)
> >
> > these takes 2 x 320 000 000 = 640 MB (double class) to store in the
> > memory. When I try to plot them i run out of memory.
>
> Yes. The object created by the PLOT function stores the X and Y data used
> to create it as the XData and YData properties inside the object. That
> means that when you PLOT, you need four contiguous blocks of 320 MB each --
> two for the x and y variables, and two for the XData and YData properties.
> If you don't have two more contiguous blocks of memory, MATLAB will
> correctly throw an Out of Memory error.
>
> Now obviously this is a contrived example. Two approaches you could use
> with your real data would be to resample your data (using INTERP1 or
> RESAMPLE) or to plot your data in pieces and only keep around those regions
> of interest.
>
> > 2) Why doesn't matlab allways "return" memory back to operating system
> > after using the plot function.
>
> See above.
>
> > I.e sometimes i try to plot large variables but runs out of memory, When I
> > then CLEAR ALL, Matlab still uses all lot of the memory according to
> > Windows Task Manager, and according to FEATURE MEMSTATS my Largest Cont.
> > Free Block is only half the size of the biggest block when im first
> > initializing Matlab. I have used the CLEAR and PACK function but i can not
> > get a bigger Larg.Cont. Free Bloc. The only solution is to restart Matlab
> > and thats a realy poor solution according to me... :-/
>
> If you have the PLOT open, then the best you could do would be to clear the
> variables from the workspace.
>
I forgot to mention that I also used CLOSE for the plot but still matlab is consuming a lot of memory.
> > 3) Is there a way to organize the 'Largest Contiguous Free Blocks', I mean
> > concatenate/defragmentate/release them somehow, without using PACK
> > function( cause it can not run in a script nor a function)
>
> No.
>
> > Im doing the calculation on a Windows XP SP2 32-bit, 3GB RAM.
>
> You should read these documents on the support website:
>
> http://www.mathworks.com/support/tech-notes/1100/1106.html
>
> http://www.mathworks.com/support/tech-notes/1100/1107.html
>
> If you're not using the 3GB switch, that may help you somewhat; but if
> you're going to be performing lots of calculations on large data sets, you
> probably want to use a 64-bit OS and a 64-bit version of MATLAB.
>
> --
> Steve Lord
> slord@mathworks.com
>
Thank you for all the information
best regards
Theo
|