AH I see ok. I should have read more carefully (a little late here).

When you commented out the INCREF on the datat, did you also comment
out PyArray_Set_BASE? If not, that may have been causing the problem.
If you set the base without INCREF'ing the data, then numpy will
DECREF that data when python goes to gc the array. Now you've lost a
reference, and if it went to zero, python then tries to gc an object
that's still in scope.



On Sun, Nov 15, 2009 at 2:55 AM, Matthew Brett <matthew.br...@gmail.com> wrote:
> Hi,
>
>> But dont forget to set base member pointer
>> (PyObject *PyArray_BASE(PyObject* arr)) to point to the python data
>> object, or else you leak a reference, and the memory will never get
>> freed.
>
> Right - for reference that's the
>
> PyArray_Set_BASE(narr, data)
>
> in the code I posted earlier (brought to you courtesy of Dag Sverre's
> workaround.h trick).
>
> Cheers,
>
> Matthew
> _______________________________________________
> Cython-dev mailing list
> Cython-dev@codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to