擅长:python、mysql、java
<p>Python的标准引用计数机制无法释放周期,因此示例中的结构将泄漏。</p>
<p>但是,<a href="http://docs.python.org/library/gc.html" rel="nofollow noreferrer">supplemental garbage collection facility</a>在默认情况下是启用的,如果它的任何组件都不能从外部访问,并且它们没有<code>__del__()</code>方法,则应该能够释放该结构。</p>
<p>如果是,垃圾收集器<a href="https://docs.python.org/3/library/gc.html#gc.garbage" rel="nofollow noreferrer">will <strong>not</strong> free them</a>因为它无法确定运行这些<code>__del__()</code>方法的安全顺序。</p>