[Top][All Lists]

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

Memory usage

From: John W. Eaton
Subject: Memory usage
Date: Wed, 8 Jan 2003 10:12:57 -0600

On  7-Jan-2003, David Pruitt <address@hidden> wrote:

| I have an octave program that calls many self-written functions as well as
| octave functions.  The program consumes a very large chunk of memory -
| (~750MB, many times more than I can rationalize based on the matrix sizes).
| The code runs over several minutes and the memory usage grows nearly
| linearly over time.  I'm guessing that memory is not being released as data
| are passed to and from functions.  
| My questions:  
| 1.    Is there some clever way to track the memory consumption with
| greater detail?

I don't know of a really good way.  What would you want the interface
to be?  What information do you want it to give you?

| 2.    Must I compel octave to release memory on return from a function?


Without additional details, I don't think we can provide much help.

Is your code only M-files, or some combination of compiled code and
M-files?  If it is compiled code, are you sure that your compiled code
is free of leaks?

Do you have any loops like

  x = [];
  for i = 1:N
    x = [x, f()];


  x = [];
  for i = 1:N
    x(i) = f();

These are good ways to slow down your program and cause what look like
memory leaks because Octave has to resize on every iteration.  In
doing that, it may also leave blocks of memory that are not useful in
future allocations.

If you think you've found a bug in Octave, please submit a complete
bug report to the bug-octave mailing list.  If you are not sure what
to include in the report, please read first.



Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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