<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello,</div><div>    Can someone explain me why gc(CPython) can not collect recursive closure's cycle reference?  There is no __del__ there, why gc can not collect?</div><div>    <span style="font-size: 14px; line-height: 1.7;">After many times gc collect, i also see objects like below in gc.garbage. So i ask why gc can not collect them? </span></div><div>    <span style="line-height: 1.7;">Thanks a  lot.</span></div><div><br></div><div>(<cell at 0x21b36a8: function object at 0x21afb90>, <cell at 0x21b36e0: list object at 0x20874d0>), <cell at 0x21b3718: function object at 0x21afc08>, <cell at 0x21b3750: list object at 0x2087488>, [1], <function aa at 0x21afc08>, (<cell at 0x21b3718: function object at 0x21afc08>, <cell at 0x21b3750: list object at 0x2087488>), <cell at 0x21b3788: function object at 0x21afc80>, <cell at 0x21b37c0: list object at 0x2087440>, [1], <function aa at 0x21afc80>, (<cell at 0x21b3788: function object at 0x21afc80>, <cell at 0x21b37c0: list object at 0x2087440>), <cell at 0x21b37f8: function object at 0x21afcf8>, <cell at 0x21b3830: list object at 0x20873f8>, [1], <function aa at 0x21afcf8>, (<cell at 0x21b37f8: function object at 0x21afcf8>, <cell at 0x21b3830: list object at 0x20873f8>), <cell at 0x21b3868: function object at 0x21afd70>, <cell at 0x21b38a0: list object at 0x20873b0>, [1], <function aa at 0x21afd70>, (<cell at 0x21b3868: function object at 0x21afd70>, <cell at 0x21b38a0: list object at 0x20873b0>), <cell at 0x21b38d8: function object at 0x21afde8>, <cell at 0x21b3910: list object at 0x2087368>, [1], <function aa at 0x21afde8>, (<cell at 0x21b38d8: function object at 0x21afde8>, <cell at 0x21b3910: list object at 0x2087368>), <cell at 0x21b3948: function object at 0x21afe60>, <cell at 0x21b3980: list object at 0x2087320>, [1], <function aa at 0x21afe60>, (<cell at 0x21b3948: function object at 0x21afe60>, <cell at 0x21b3980: list object at 0x2087320>), <cell at 0x21b39b8: function object at 0x21afed8>,</div><div><br></div><div><br></div><div>The test program is below.</div><div><div>#!/usr/bin/env python</div><div><br></div><div>import ipdb</div><div>import gc</div><div><br></div><div>gc.set_debug(gc.DEBUG_LEAK)</div><div><br></div><div>def A():</div><div><span class="Apple-tab-span" style="white-space: pre;">     </span>N = [1]</div><div><span class="Apple-tab-span" style="white-space: pre;">    </span>def aa(n):</div><div><span class="Apple-tab-span" style="white-space: pre;">         </span>if n in N:</div><div><span class="Apple-tab-span" style="white-space: pre;">                 </span>return 1</div><div><span class="Apple-tab-span" style="white-space: pre;">           </span>else:</div><div><span class="Apple-tab-span" style="white-space: pre;">                      </span>return n * aa(n-1)</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre;">        </span>x = 33 + aa(10)</div><div><span class="Apple-tab-span" style="white-space: pre;">    </span>#ipdb.set_trace()</div><div><span class="Apple-tab-span" style="white-space: pre;">  </span>print x </div><div><br></div><div><br></div><div>if __name__ == '__main__':</div><div><span class="Apple-tab-span" style="white-space: pre;">   </span>while xrange(1000):</div><div><span class="Apple-tab-span" style="white-space: pre;">                </span>A()</div></div><br><br><span style="font-size: 14px; line-height: 1.7;">--</span><br><div><div>Best</div><div>    Li Tianqing</div></div></div>