[Numpy-discussion] Array data ownership

Konrad Hinsen hinsen at cnrs-orleans.fr
Tue Nov 19 05:29:06 CST 2002


> No. I want to set the memory zone of the array but once this zone is
> set, I want numpy to manage it as if it was owner of the memory.

That is the most frequent case for which there is no clean solution.
There ought to be an array constructor that takes a pointer to a
deallocation function which is called to free the data space.

You can do myarray->flags |= OWN_DATA, then the data space will be
freed using the standard free() function. But this is undocumented,
and works only if the standard OS memory allocation calls were used to
allocate the memory.

Konrad.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the Numpy-discussion mailing list