Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ee1450ca
Commit
ee1450ca
authored
Dec 07, 2001
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added more information about reference counting limitations and the cycle
detector. This closes SF bug #484950.
parent
7a7db8ca
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
Doc/ext/extending.tex
Doc/ext/extending.tex
+27
-0
No files found.
Doc/ext/extending.tex
View file @
ee1450ca
...
...
@@ -1232,6 +1232,33 @@ Maybe some day a sufficiently portable automatic garbage collector
will be available for C. Until then, we'll have to live with
reference counts.
While Python uses the traditional reference counting implementation,
it also offers a cycle detector that works to detect reference
cycles. This allows applications to not worry about creating direct
or indirect circular references; these are the weakness of garbage
collection implemented using only reference counting. Reference
cycles consist of objects which contain (possibly indirect) references
themselves so that each object in the cycle has a reference count
which is non-zero. Typical reference counting implementations are not
able to reclaim the memory beloning to any objects in a reference
cycle, or referenced from the objects in the cycle, even though there
are no further references to the cycle itself.
The cycle detector is able to detect garbage cycles and can reclaim
them so long as there are no finalizers implemented in Python
(
\method
{__
del
__
()
}
methods). When there are such finalizers, the
detector exposes the cycles through the
\ulink
{
\module
{
gc
}
module
}{
../lib/module-gc.html
}
. The
\module
{
gc
}
module also exposes
configuration interfaces and the ability to disable the detector at
runtime. The cycle detector is considered an optional component;
though it is included by default, it can be disabled at compile time
using the
\longprogramopt
{
without-cycle-gc
}
option to the
\program
{
configure
}
script on
\UNIX
{}
platforms (including Mac OS X)
or by removing the definition of
\code
{
WITH
_
CYCLE
_
GC
}
in the
\file
{
pyconfig.h
}
header on other platforms. If the cycle detector is
disabled in this way, the
\module
{
gc
}
module will not be available.
\subsection
{
Reference Counting in Python
\label
{
refcountsInPython
}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment