[Numpy-discussion] C extension in new numpy: help to port from numarray

Sebastian Haase haase at msg.ucsf.edu
Wed May 10 10:41:02 EDT 2006


On Wednesday 10 May 2006 10:05, Travis Oliphant wrote:
> Sebastian Haase wrote:
> > One additional question:
> > is  PyArray_FromDimsAndData creating a copy ?
> > I have very large image data and cannot afford copies :-(
>
> No,  it uses the data as the memory space for the array (but you have to
> either manage that memory area yourself or reset the OWNDATA flag to get
> NumPy to delete it for you on array deletion).
>
> -Travis

Thanks for the reply.
Regarding "setting the OWNDATA flag":  
How does NumPy know if it should call free (C code) or delete [] (C++ code) ?
I have been told that at least on some platforms its crucial to properly match 
those with if you used malloc or the new-operator (only available in C++).

Thanks,
- Sebastian




More information about the NumPy-Discussion mailing list