[Numpy-discussion] quick C api array creation question
Charles سمير Doutriaux
doutriaux1@llnl....
Wed Jul 15 18:27:22 CDT 2009
Hi,
I'm using a C api to create numpy array
I create them in my C as follow:
np_ow = (PyArrayObject *)PyArray_SimpleNew(4, dims, NPY_DOUBLE);
np_osfc = (PyArrayObject *)PyArray_SimpleNew(3, dims, NPY_DOUBLE);
np_ospc = (PyArrayObject *)PyArray_SimpleNew(3, dims, NPY_DOUBLE);
PyArray_FILLWBYTE(np_ow,0);
PyArray_FILLWBYTE(np_osfc,0);
PyArray_FILLWBYTE(np_ospc,0);
...
return Py_BuildValue("OOO",np_ow,np_osfc,np_ospc);
It seems to work and they get back nicely to the python, no problem
The only "little" issue I have is that the memory is never released!
And quickly my code runs out of memory
Any pointer on what I'm doing wrong?
Do I need a decref somewhere?
C.
More information about the NumPy-Discussion
mailing list