GC and extension types

David Abrahams abrahams at mediaone.net
Sat Mar 3 22:35:43 EST 2001


Is there documentation someplace on what I must do to make my extension
types play nicely with GC? I am worried that if I store a pointer to a
PyObject* in some arbitrary memory (and increment its reference count, of
course!), the collector might decide it was unreachable anyway and collect
it.

>From looking at the source code, I have an inkling that it might try to
account for all the references in a cycle, so that objects will only be
collected when all known references can be accounted for by the (reachable)
cycles in which it participates. I guess this would create the opposite but
more benign problem of being too conservative.

Anyway, I'm hoping there is authoritative text somewhere that describes
what's really going on... and that the text isn't just 'C' code!

Any help appreciated,
Dave





More information about the Python-list mailing list