Reference cycles
Peter Otten
__peter__ at web.de
Sun Sep 24 12:23:20 EDT 2017
Steve D'Aprano wrote:
> Is there a way to log when the garbage collector finds and collects a
> reference cycle?
>
> I don't care about objects claimed by the reference counter, I only care
> about cycles.
I don't know, and I don't think so. Would a structure like
a --- b --- c
| | |
d --- e --- f
count as one, or two, or three cycles? If you have a clear answer to that
you can save the collected objects in gc.garbage and count the cycles
yourself.
More information about the Python-list
mailing list