[Numpy-discussion] memory not being freed

Mathew Yeates mathew at fugue.jpl.nasa.gov
Fri Feb 22 16:20:02 CST 2002

I'm having problems with garbage collection
I wrote an extension which creates an array
and returns it

foo() {
arr = (PyArrayObject *) PyArray_FromDims( .....
ret = Py_BuildValue("O", arr);
return ret;

but now if I do
while 1:

memory is never free'd. I've even tried explicitly calling gc.collect and
adding del(a) after a=foo.

Is the problem that Py_BuildValue increases the reference count?


More information about the Numpy-discussion mailing list