I am trying to understand how octave's memory usage works. I have a
simple program and function file which I have attached (see below) that
seems to be leaking memory. The same program called in matlab leaks no
memory. Could someone explain the logic of memory usage in this simple
program. I have a much larger and more complex program with calls to
.oct files and functions, which also leaks memory.
The main program file (testmem.m) has the following lines of code:
The function file (testfun.m) contains the following code:
function xx = testfun(p)
When this program is run in matlab it takes up 8488K (as measured by top
running on a unix workstation Solaris 2.5.1). In Octave (2.0.13) it
starts out using 9208K but grows by the 500th time through the loop to
9416K. What is causing this memory leak?
Also, I thought it was odd that the clear command did not also delete
the counter "i" and cause the program to bomb. Why does this not occur.
Any insights into memory usage in octave would be appreciated.