[SciPy-User] Memory Leak? Problems with deleting numpy arrays.
Stuart Wilkins
swilkins at bnl.gov
Fri Nov 5 10:08:10 EDT 2010
David,
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.....
Thanks,
Stuart
More information about the SciPy-User
mailing list