[Numpy-discussion] views and object lifetime

Scott Sinclair scott.sinclair.za@gmail....
Wed Feb 18 08:54:10 CST 2009


> 2009/2/18 Neal Becker <ndbecker2@gmail.com>:
> Matthieu Brucher <matthieu.brucher <at> gmail.com> writes:
>
>>
>> B has a reference to A.
>
> Could you be more specific?  Where is this reference stored?  What C api
> functions are used?

I'm probably not qualified to be much more specific, these links
should provide the necessary detail:

http://docs.scipy.org/doc/numpy/reference/c-api.html#numpy-c-api
http://docs.python.org/c-api/intro.html#objects-types-and-reference-counts
http://docs.python.org/extending/newtypes.html

The Python interpreter takes care of when to free the memory
associated with an object once it's reference count reaches zero. The
object reference counts are increased and decreased directly in C code
using the Py_INCREF and Py_DECREF macros whenever a new object is
created or a new pointer assigned to an existing object.

Cheers,
Scott


More information about the Numpy-discussion mailing list