help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loops resource usage.


From: Muthiah Annamalai
Subject: Re: Loops resource usage.
Date: Fri, 22 Jun 2007 10:23:52 -0500

On 6/22/07, John W. Eaton <address@hidden> wrote:
On 21-Jun-2007, Muthiah Annamalai wrote:

| Hello there,
|
| I wanted to ask if there is a difference between writing a program like
|
| for x=linspace(-pi:+pi,Npts)
|    [X,Y,Z,L,M,N]=init_variables();
|    do_a_time_consuming_long_computation();
|
|   %clear the memory used
|
|    clear all
| end
|
| % and this function?
|
| for x=linspace(-pi:+pi,Npts)
|    [X,Y,Z,L,M,N]=init_variables();
|    do_a_time_consuming_long_computation();
| end
|
|
| My advisor told me, it saves something and does better in long programs.
| Thanks in advance.

Doing "clear all" also clears all function definitions, so they will
have to be reloaded the next time through the loop (which will also
cause any persistent variables to be reinitialized).  In Matlab, "clear
all" also deletes debugging breakpoints.  Is that the effect you
really want?

jwe

First, thanks for answering this question (David Grohman, JWE).

I dont want things to be reloaded or lose context by clear all. I was
curious to know if doing something within loops will boost up memory
usage to brink of slowing down Octave itself.

From what I hear it doesnt seem to be the case.

Thanks,
-Muthu


reply via email to

[Prev in Thread] Current Thread [Next in Thread]