[SciPy-user] Weave Memory Leak?

Greg Novak novak at ucolick.org
Tue Oct 19 20:23:49 CDT 2004


A few days ago I wrote the list about a memory leak in code involving
Weave.  Now I'm ready to run it up the flagpole.

I've put the code here:
http://www.ucolick.org/~novak/memory-leak.tgz

The problem is in the integrate() python function.  If I replace it
with code that doesn't use Weave (just returns reasonable fake data),
there's no memory problem.
 
If anyone is kind enough to look at the code, note how the call to
odeint() within integrate() is commented out.  So all I do is allocate
some space w/ malloc through dmatrix(), fill it with fake data,
allocate a new Numeric array, copy the fake data into it, deallocate
the space allocated w/ malloc, and then set return_val to the Numeric
array.  There's no way to return from the function without calling
dmatrix_free().

I thought at first that the reference count to the aforementioned
Numeric array was incremented one too many times, but if I call
Py_DECREF() on it, I get a core dump, presumably b/c the array is
de-allocated.

That's all.  Thanks a bunch for any assistance.

Greg



More information about the SciPy-user mailing list