[C++-sig] create boost array from a Numpy PyArray without copying data?
Ravi
lists_ravi at lavabit.com
Thu Jan 22 16:27:25 CET 2009
On Thursday 22 January 2009 05:51:20 Sebastian Walter wrote:
> In my above case I know that *x won't be deleted because it is global,
> right?
*x is not deleted since you used PyArray_SimpleNewFromData; that *x is a
global is irrelevant here.
> Why exactly does the
> *** glibc detected *** python: malloc(): memory corruption (fast):
> 0x0817b6a1 ***
> occur then?
In the code you posted this time, incref() is required so that someone owns a
reference to the array object. What I don't know off the top of my head is
whether you need an incref in the constructor of A and a decref in the
destructor of A.
> And is there a way to get the refcount of an object within Python? I'd
> like to test if the refcount is correct.
sys.getrefcount(obj)
Regards,
Ravi
More information about the Cplusplus-sig
mailing list