(original) (raw)
Hello,
Can someone explain me why gc(CPython) can not collect recursive closure's cycle reference? There is no \_\_del\_\_ here, why gc can not collect?
Thanks a lot.
For example:
#!/usr/bin/env python
import ipdb
import gc
gc.set\_debug(gc.DEBUG\_LEAK)
def A():
N = \[1\]
def aa(n):
if n in N:
return 1
else:
return n \* aa(n-1)
x = 33 + aa(10)
#ipdb.set\_trace()
print x
if \_\_name\_\_ == '\_\_main\_\_':
while xrange(1000):
A()
--
Best
Li Tianqing