[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
John W. Eaton
Fri, 19 Jun 1998 13:59:03 -0500 (CDT)
On 19-Jun-1998, Karen L. Kalat <address@hidden> wrote:
| I'm working on an application with an octave program that goes through
| the following steps.
| 1) executes system calls to other programs to generate and compile a C
| 2) executes a system call to "mkoctfile" to create a .oct file
| that uses the C code.
| 3) executes the new function (always with the same name) in Octave. The
| function's return values are always assigned to the same variables.
| I do this whole process over and over. I use malloc in the C program but
| I make sure to deallocate any memory that is allocated. However as I
| run the program again and again in Octave the memory usage goes up and up
| and I eventually run out of room.
| Where is the memory being taken up? Is there something I can do to
| prevent it?
It's impossible to answer these questions without more information.
Perhaps the memory leak is in your code. Can you try replacing the
code in your .oct file with something that doesn't allocate memory?
Are there other things in your code that could cause memory problems?
For example, code like
x = 
for i = 1:N
x = [x, f()];
for i = 1:N
x(i) = f();
can cause trouble because Octave is forced to resize arrays over and
over, and the memory that is freed may not be suitable for reuse by
any other allocations. You can avoid both of these kinds of problems
by sizing the result array outside the loop. You can find problems
like this by setting resize_on_range_error = 0 and
empty_list_elements_ok = 0.
If the bug does seem to be in Octave, can you please submit a complete
bug report to address@hidden that contains enough
information to reproduce the problem?
- memory problem, Karen L. Kalat, 1998/06/19
- memory problem,
John W. Eaton <=