Circular references not being cleaned up by Py_Finalize()

blackpawn pharmapsychotic at gmail.com
Tue Mar 25 16:22:55 EDT 2008


> Does the Noddy example use GC (Py_TPFLAGS_HAVE_GC)? Container objects
> must use the cycle GC or circular referneces aren't broken. Have you
> tried calling PyGC_Collect() multiple times?

Yeah the Noddy example is from "2.1.3 Supporting cyclic garbage
collection" part of the Python docs.  They list sample C and Python
code which I cut and pasted with no changes and on Py_Finalize and app
shut down it leaks the object.  I know the garbage collector is
tracking the object because it properly calls the traverse function
but for whatever reason it never calls the clear function.  Does
anyone have experience with circular references and had success with
it or the example in the docs?



More information about the Python-list mailing list