[SciPy-User] Memory Leak? Problems with deleting numpy arrays.

Stuart Wilkins swilkins@bnl....
Fri Nov 5 09:08:10 CDT 2010


Thanks for your reply. So far I am not inc'refing the variable, as far as I can tell. 

My c-code produces the array as:

qOut = PyArray_SimpleNew(2, dims, NPY_DOUBLE);

I assign the data using the pointer I get from:

qOutp = (_float *)PyArray_DATA(qOut);

When the routine ends, it is passed back by:

return Py_BuildValue("N", qOut);

(I have also tried just "return qOut;")

If i check the refcount when the routine returns I get a value of 2 from the code below....

totSet = ctrans.ccdToQ(...)
print sys.getrefcount(totSet)

If I Py_DECREF before the c routine returns then the code segfaults.....


More information about the SciPy-User mailing list