[Numpy-discussion] Creating PyArrayObject in C++
Stéfan van der Walt
Tue Jul 7 17:20:16 CDT 2009
2009/7/7 Kenny Abernathy <firstname.lastname@example.org>:
> I can guarantee that all analysis will be finished before the Unit object is
> destroyed and delete is called, so I don't think that's a problem.
There is a neat trick to make sure things don't get deallocated out of order:
> However, what if there are modifications to the array from within a Python
> script (specifically changes to the number of elements in the array). I
> should be able to get the new size from PyArrayObject, but will it have any
> effect on the delete operation?
NumPy won't reallocate any of your memory if you set the array flag
OWNDATA to False, so it should be safe to deallocate as usual.
More information about the NumPy-Discussion