晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /usr/share/doc/python2-docs/html/library/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>28.12. gc — Garbage Collector interface — Python 2.7.16 documentation</title>
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/sidebar.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within Python 2.7.16 documentation"
href="../_static/opensearch.xml"/>
<link rel="author" title="About these documents" href="../about.html" />
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="copyright" title="Copyright" href="../copyright.html" />
<link rel="next" title="28.13. inspect — Inspect live objects" href="inspect.html" />
<link rel="prev" title="28.11. __future__ — Future statement definitions" href="__future__.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
<link rel="canonical" href="https://docs.python.org/2/library/gc.html" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="inspect.html" title="28.13. inspect — Inspect live objects"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="__future__.html" title="28.11. __future__ — Future statement definitions"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.16 documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
<li class="nav-item nav-item-2"><a href="python.html" accesskey="U">28. Python Runtime Services</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-gc">
<span id="gc-garbage-collector-interface"></span><h1>28.12. <a class="reference internal" href="#module-gc" title="gc: Interface to the cycle-detecting garbage collector."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gc</span></code></a> — Garbage Collector interface<a class="headerlink" href="#module-gc" title="Permalink to this headline">¶</a></h1>
<p>This module provides an interface to the optional garbage collector. It
provides the ability to disable the collector, tune the collection frequency,
and set debugging options. It also provides access to unreachable objects that
the collector found but cannot free. Since the collector supplements the
reference counting already used in Python, you can disable the collector if you
are sure your program does not create reference cycles. Automatic collection
can be disabled by calling <code class="docutils literal notranslate"><span class="pre">gc.disable()</span></code>. To debug a leaking program call
<code class="docutils literal notranslate"><span class="pre">gc.set_debug(gc.DEBUG_LEAK)</span></code>. Notice that this includes
<code class="docutils literal notranslate"><span class="pre">gc.DEBUG_SAVEALL</span></code>, causing garbage-collected objects to be saved in
gc.garbage for inspection.</p>
<p>The <a class="reference internal" href="#module-gc" title="gc: Interface to the cycle-detecting garbage collector."><code class="xref py py-mod docutils literal notranslate"><span class="pre">gc</span></code></a> module provides the following functions:</p>
<dl class="function">
<dt id="gc.enable">
<code class="descclassname">gc.</code><code class="descname">enable</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.enable" title="Permalink to this definition">¶</a></dt>
<dd><p>Enable automatic garbage collection.</p>
</dd></dl>
<dl class="function">
<dt id="gc.disable">
<code class="descclassname">gc.</code><code class="descname">disable</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.disable" title="Permalink to this definition">¶</a></dt>
<dd><p>Disable automatic garbage collection.</p>
</dd></dl>
<dl class="function">
<dt id="gc.isenabled">
<code class="descclassname">gc.</code><code class="descname">isenabled</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.isenabled" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns true if automatic collection is enabled.</p>
</dd></dl>
<dl class="function">
<dt id="gc.collect">
<code class="descclassname">gc.</code><code class="descname">collect</code><span class="sig-paren">(</span><span class="optional">[</span><em>generation</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.collect" title="Permalink to this definition">¶</a></dt>
<dd><p>With no arguments, run a full collection. The optional argument <em>generation</em>
may be an integer specifying which generation to collect (from 0 to 2). A
<a class="reference internal" href="exceptions.html#exceptions.ValueError" title="exceptions.ValueError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">ValueError</span></code></a> is raised if the generation number is invalid. The number of
unreachable objects found is returned.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.5: </span>The optional <em>generation</em> argument was added.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.6: </span>The free lists maintained for a number of built-in types are cleared
whenever a full collection or collection of the highest generation (2)
is run. Not all items in some free lists may be freed due to the
particular implementation, in particular <a class="reference internal" href="functions.html#int" title="int"><code class="xref py py-class docutils literal notranslate"><span class="pre">int</span></code></a> and <a class="reference internal" href="functions.html#float" title="float"><code class="xref py py-class docutils literal notranslate"><span class="pre">float</span></code></a>.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="gc.set_debug">
<code class="descclassname">gc.</code><code class="descname">set_debug</code><span class="sig-paren">(</span><em>flags</em><span class="sig-paren">)</span><a class="headerlink" href="#gc.set_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the garbage collection debugging flags. Debugging information will be
written to <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code>. See below for a list of debugging flags which can be
combined using bit operations to control debugging.</p>
</dd></dl>
<dl class="function">
<dt id="gc.get_debug">
<code class="descclassname">gc.</code><code class="descname">get_debug</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.get_debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the debugging flags currently set.</p>
</dd></dl>
<dl class="function">
<dt id="gc.get_objects">
<code class="descclassname">gc.</code><code class="descname">get_objects</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.get_objects" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a list of all objects tracked by the collector, excluding the list
returned.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.2.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="gc.set_threshold">
<code class="descclassname">gc.</code><code class="descname">set_threshold</code><span class="sig-paren">(</span><em>threshold0</em><span class="optional">[</span>, <em>threshold1</em><span class="optional">[</span>, <em>threshold2</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.set_threshold" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the garbage collection thresholds (the collection frequency). Setting
<em>threshold0</em> to zero disables collection.</p>
<p>The GC classifies objects into three generations depending on how many
collection sweeps they have survived. New objects are placed in the youngest
generation (generation <code class="docutils literal notranslate"><span class="pre">0</span></code>). If an object survives a collection it is moved
into the next older generation. Since generation <code class="docutils literal notranslate"><span class="pre">2</span></code> is the oldest
generation, objects in that generation remain there after a collection. In
order to decide when to run, the collector keeps track of the number object
allocations and deallocations since the last collection. When the number of
allocations minus the number of deallocations exceeds <em>threshold0</em>, collection
starts. Initially only generation <code class="docutils literal notranslate"><span class="pre">0</span></code> is examined. If generation <code class="docutils literal notranslate"><span class="pre">0</span></code> has
been examined more than <em>threshold1</em> times since generation <code class="docutils literal notranslate"><span class="pre">1</span></code> has been
examined, then generation <code class="docutils literal notranslate"><span class="pre">1</span></code> is examined as well. Similarly, <em>threshold2</em>
controls the number of collections of generation <code class="docutils literal notranslate"><span class="pre">1</span></code> before collecting
generation <code class="docutils literal notranslate"><span class="pre">2</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="gc.get_count">
<code class="descclassname">gc.</code><code class="descname">get_count</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.get_count" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current collection counts as a tuple of <code class="docutils literal notranslate"><span class="pre">(count0,</span> <span class="pre">count1,</span>
<span class="pre">count2)</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.5.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="gc.get_threshold">
<code class="descclassname">gc.</code><code class="descname">get_threshold</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gc.get_threshold" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current collection thresholds as a tuple of <code class="docutils literal notranslate"><span class="pre">(threshold0,</span>
<span class="pre">threshold1,</span> <span class="pre">threshold2)</span></code>.</p>
</dd></dl>
<dl class="function">
<dt id="gc.get_referrers">
<code class="descclassname">gc.</code><code class="descname">get_referrers</code><span class="sig-paren">(</span><em>*objs</em><span class="sig-paren">)</span><a class="headerlink" href="#gc.get_referrers" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the list of objects that directly refer to any of objs. This function
will only locate those containers which support garbage collection; extension
types which do refer to other objects but do not support garbage collection will
not be found.</p>
<p>Note that objects which have already been dereferenced, but which live in cycles
and have not yet been collected by the garbage collector can be listed among the
resulting referrers. To get only currently live objects, call <a class="reference internal" href="#gc.collect" title="gc.collect"><code class="xref py py-func docutils literal notranslate"><span class="pre">collect()</span></code></a>
before calling <a class="reference internal" href="#gc.get_referrers" title="gc.get_referrers"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_referrers()</span></code></a>.</p>
<p>Care must be taken when using objects returned by <a class="reference internal" href="#gc.get_referrers" title="gc.get_referrers"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_referrers()</span></code></a> because
some of them could still be under construction and hence in a temporarily
invalid state. Avoid using <a class="reference internal" href="#gc.get_referrers" title="gc.get_referrers"><code class="xref py py-func docutils literal notranslate"><span class="pre">get_referrers()</span></code></a> for any purpose other than
debugging.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.2.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="gc.get_referents">
<code class="descclassname">gc.</code><code class="descname">get_referents</code><span class="sig-paren">(</span><em>*objs</em><span class="sig-paren">)</span><a class="headerlink" href="#gc.get_referents" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of objects directly referred to by any of the arguments. The
referents returned are those objects visited by the arguments’ C-level
<a class="reference internal" href="../c-api/typeobj.html#c.PyTypeObject.tp_traverse" title="PyTypeObject.tp_traverse"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_traverse</span></code></a> methods (if any), and may not be all objects actually
directly reachable. <a class="reference internal" href="../c-api/typeobj.html#c.PyTypeObject.tp_traverse" title="PyTypeObject.tp_traverse"><code class="xref c c-member docutils literal notranslate"><span class="pre">tp_traverse</span></code></a> methods are supported only by objects
that support garbage collection, and are only required to visit objects that may
be involved in a cycle. So, for example, if an integer is directly reachable
from an argument, that integer object may or may not appear in the result list.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.3.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="gc.is_tracked">
<code class="descclassname">gc.</code><code class="descname">is_tracked</code><span class="sig-paren">(</span><em>obj</em><span class="sig-paren">)</span><a class="headerlink" href="#gc.is_tracked" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns <code class="docutils literal notranslate"><span class="pre">True</span></code> if the object is currently tracked by the garbage collector,
<code class="docutils literal notranslate"><span class="pre">False</span></code> otherwise. As a general rule, instances of atomic types aren’t
tracked and instances of non-atomic types (containers, user-defined
objects…) are. However, some type-specific optimizations can be present
in order to suppress the garbage collector footprint of simple instances
(e.g. dicts containing only atomic keys and values):</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">gc</span><span class="o">.</span><span class="n">is_tracked</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="go">False</span>
<span class="gp">>>> </span><span class="n">gc</span><span class="o">.</span><span class="n">is_tracked</span><span class="p">(</span><span class="s2">"a"</span><span class="p">)</span>
<span class="go">False</span>
<span class="gp">>>> </span><span class="n">gc</span><span class="o">.</span><span class="n">is_tracked</span><span class="p">([])</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="n">gc</span><span class="o">.</span><span class="n">is_tracked</span><span class="p">({})</span>
<span class="go">False</span>
<span class="gp">>>> </span><span class="n">gc</span><span class="o">.</span><span class="n">is_tracked</span><span class="p">({</span><span class="s2">"a"</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
<span class="go">False</span>
<span class="gp">>>> </span><span class="n">gc</span><span class="o">.</span><span class="n">is_tracked</span><span class="p">({</span><span class="s2">"a"</span><span class="p">:</span> <span class="p">[]})</span>
<span class="go">True</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.7.</span></p>
</div>
</dd></dl>
<p>The following variable is provided for read-only access (you can mutate its
value but should not rebind it):</p>
<dl class="data">
<dt id="gc.garbage">
<code class="descclassname">gc.</code><code class="descname">garbage</code><a class="headerlink" href="#gc.garbage" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of objects which the collector found to be unreachable but could not be
freed (uncollectable objects). By default, this list contains only objects with
<a class="reference internal" href="../reference/datamodel.html#object.__del__" title="object.__del__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__del__()</span></code></a> methods. <a class="footnote-reference" href="#id2" id="id1">[1]</a> Objects that have <a class="reference internal" href="../reference/datamodel.html#object.__del__" title="object.__del__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__del__()</span></code></a> methods and are
part of a reference cycle cause the entire reference cycle to be uncollectable,
including objects not necessarily in the cycle but reachable only from it.
Python doesn’t collect such cycles automatically because, in general, it isn’t
possible for Python to guess a safe order in which to run the <a class="reference internal" href="../reference/datamodel.html#object.__del__" title="object.__del__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__del__()</span></code></a>
methods. If you know a safe order, you can force the issue by examining the
<em>garbage</em> list, and explicitly breaking cycles due to your objects within the
list. Note that these objects are kept alive even so by virtue of being in the
<em>garbage</em> list, so they should be removed from <em>garbage</em> too. For example,
after breaking cycles, do <code class="docutils literal notranslate"><span class="pre">del</span> <span class="pre">gc.garbage[:]</span></code> to empty the list. It’s
generally better to avoid the issue by not creating cycles containing objects
with <a class="reference internal" href="../reference/datamodel.html#object.__del__" title="object.__del__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__del__()</span></code></a> methods, and <em>garbage</em> can be examined in that case to
verify that no such cycles are being created.</p>
<p>If <a class="reference internal" href="#gc.DEBUG_SAVEALL" title="gc.DEBUG_SAVEALL"><code class="xref py py-const docutils literal notranslate"><span class="pre">DEBUG_SAVEALL</span></code></a> is set, then all unreachable objects will be added to
this list rather than freed.</p>
</dd></dl>
<p>The following constants are provided for use with <a class="reference internal" href="#gc.set_debug" title="gc.set_debug"><code class="xref py py-func docutils literal notranslate"><span class="pre">set_debug()</span></code></a>:</p>
<dl class="data">
<dt id="gc.DEBUG_STATS">
<code class="descclassname">gc.</code><code class="descname">DEBUG_STATS</code><a class="headerlink" href="#gc.DEBUG_STATS" title="Permalink to this definition">¶</a></dt>
<dd><p>Print statistics during collection. This information can be useful when tuning
the collection frequency.</p>
</dd></dl>
<dl class="data">
<dt id="gc.DEBUG_COLLECTABLE">
<code class="descclassname">gc.</code><code class="descname">DEBUG_COLLECTABLE</code><a class="headerlink" href="#gc.DEBUG_COLLECTABLE" title="Permalink to this definition">¶</a></dt>
<dd><p>Print information on collectable objects found.</p>
</dd></dl>
<dl class="data">
<dt id="gc.DEBUG_UNCOLLECTABLE">
<code class="descclassname">gc.</code><code class="descname">DEBUG_UNCOLLECTABLE</code><a class="headerlink" href="#gc.DEBUG_UNCOLLECTABLE" title="Permalink to this definition">¶</a></dt>
<dd><p>Print information of uncollectable objects found (objects which are not
reachable but cannot be freed by the collector). These objects will be added to
the <code class="docutils literal notranslate"><span class="pre">garbage</span></code> list.</p>
</dd></dl>
<dl class="data">
<dt id="gc.DEBUG_INSTANCES">
<code class="descclassname">gc.</code><code class="descname">DEBUG_INSTANCES</code><a class="headerlink" href="#gc.DEBUG_INSTANCES" title="Permalink to this definition">¶</a></dt>
<dd><p>When <a class="reference internal" href="#gc.DEBUG_COLLECTABLE" title="gc.DEBUG_COLLECTABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DEBUG_COLLECTABLE</span></code></a> or <a class="reference internal" href="#gc.DEBUG_UNCOLLECTABLE" title="gc.DEBUG_UNCOLLECTABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DEBUG_UNCOLLECTABLE</span></code></a> is set, print
information about instance objects found.</p>
</dd></dl>
<dl class="data">
<dt id="gc.DEBUG_OBJECTS">
<code class="descclassname">gc.</code><code class="descname">DEBUG_OBJECTS</code><a class="headerlink" href="#gc.DEBUG_OBJECTS" title="Permalink to this definition">¶</a></dt>
<dd><p>When <a class="reference internal" href="#gc.DEBUG_COLLECTABLE" title="gc.DEBUG_COLLECTABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DEBUG_COLLECTABLE</span></code></a> or <a class="reference internal" href="#gc.DEBUG_UNCOLLECTABLE" title="gc.DEBUG_UNCOLLECTABLE"><code class="xref py py-const docutils literal notranslate"><span class="pre">DEBUG_UNCOLLECTABLE</span></code></a> is set, print
information about objects other than instance objects found.</p>
</dd></dl>
<dl class="data">
<dt id="gc.DEBUG_SAVEALL">
<code class="descclassname">gc.</code><code class="descname">DEBUG_SAVEALL</code><a class="headerlink" href="#gc.DEBUG_SAVEALL" title="Permalink to this definition">¶</a></dt>
<dd><p>When set, all unreachable objects found will be appended to <em>garbage</em> rather
than being freed. This can be useful for debugging a leaking program.</p>
</dd></dl>
<dl class="data">
<dt id="gc.DEBUG_LEAK">
<code class="descclassname">gc.</code><code class="descname">DEBUG_LEAK</code><a class="headerlink" href="#gc.DEBUG_LEAK" title="Permalink to this definition">¶</a></dt>
<dd><p>The debugging flags necessary for the collector to print information about a
leaking program (equal to <code class="docutils literal notranslate"><span class="pre">DEBUG_COLLECTABLE</span> <span class="pre">|</span> <span class="pre">DEBUG_UNCOLLECTABLE</span> <span class="pre">|</span>
<span class="pre">DEBUG_INSTANCES</span> <span class="pre">|</span> <span class="pre">DEBUG_OBJECTS</span> <span class="pre">|</span> <span class="pre">DEBUG_SAVEALL</span></code>).</p>
</dd></dl>
<p class="rubric">Footnotes</p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>Prior to Python 2.2, the list contained all instance objects in unreachable
cycles, not only those with <a class="reference internal" href="../reference/datamodel.html#object.__del__" title="object.__del__"><code class="xref py py-meth docutils literal notranslate"><span class="pre">__del__()</span></code></a> methods.</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="__future__.html"
title="previous chapter">28.11. <code class="docutils literal notranslate"><span class="pre">__future__</span></code> — Future statement definitions</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="inspect.html"
title="next chapter">28.13. <code class="docutils literal notranslate"><span class="pre">inspect</span></code> — Inspect live objects</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../_sources/library/gc.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="inspect.html" title="28.13. inspect — Inspect live objects"
>next</a> |</li>
<li class="right" >
<a href="__future__.html" title="28.11. __future__ — Future statement definitions"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> »</li>
<li>
<a href="../index.html">Python 2.7.16 documentation</a> »
</li>
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
<li class="nav-item nav-item-2"><a href="python.html" >28. Python Runtime Services</a> »</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 1990-2019, Python Software Foundation.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
Last updated on Mar 27, 2019.
<a href="../bugs.html">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.7.6.
</div>
</body>
</html>