Jim Kleckner wrote:
> cycles:
> 
> I understand from the documentation that types with a finalizer method 
> that participate in cycles can't be collected.
> 
> What is the best way to go about finding these cycles?
> Googling gives a variety of methods none of which seem terribly 
> mainstream for such a common problem.

    Put the Python garbage collector into debug mode and find out
what it reports as non-collectable.

    Use weak pointers where appropriate to avoid cycles.
The general idea is that pointers back towards the root
of a tree structure should be weak pointers, which will
result in a cycle-free structure.  I put that in BeautifulSoup,
and it works quite well.

                                John Nagle

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to