I'm making a C extension for Python that returns a numpy
array.
I do something like this
int *d = malloc(...
//set values in d
return PyArray_SimpleNewFromData(...., d);
When the newly created array is garbage collected, I want to ensure the memory in d
is also deallocated.
What is the best way to do this?