python garbage collection
In the reference count-based, but can not solve circular references, to recover supplemented generational
import gc
class A():
def __init__(self):
print('object born, id:%s' % str(hex(id(self))))
def f2():
while True:
a1 = A()
a2 = A()
a1.t = a2
a2.t = a1
del a1
del a2
gc.disable()
f2()
This list is somewhat similar: