[Python-Dev] recursive closure (original) (raw)
Li Tianqing jazeltq at 163.com
Thu Sep 11 04:55:40 CEST 2014
- Previous message: [Python-Dev] Smuggling bytes in a UTF-16 implementation of str/unicode (was: Multilingual programming article on the Red Hat Developer blog)
- Next message: [Python-Dev] recursive closure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20140911/f44db6df/attachment.html>
- Previous message: [Python-Dev] Smuggling bytes in a UTF-16 implementation of str/unicode (was: Multilingual programming article on the Red Hat Developer blog)
- Next message: [Python-Dev] recursive closure
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]