Skip to content

Instantly share code, notes, and snippets.

@mitsuhiko
Created June 7, 2017 20:11
Show Gist options
  • Save mitsuhiko/8b05a2e36e5981c12f90a52f8f03fb3a to your computer and use it in GitHub Desktop.
Save mitsuhiko/8b05a2e36e5981c12f90a52f8f03fb3a to your computer and use it in GitHub Desktop.
>>> class A(object):
... def __del__(self):
... pass
...
>>> class B(object):
... def __del__(self):
... pass
...
>>> a = A()
>>> a.b = B()
>>> a.b.a = a
>>> import gc
>>> del a
>>> gc.collect()
4
>>> gc.garbage
[<__main__.A object at 0x1028e4710>, <__main__.B object at 0x1028e4750>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment