Skip to content

Commit 31c2839

Browse files
committed
Tidy docs about tuple tracking
1 parent 2859bec commit 31c2839

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

InternalDocs/garbage_collector.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -546,20 +546,17 @@ a container:
546546
2. When the container is examined by the garbage collector.
547547

548548
As a general rule, instances of atomic types aren't tracked and instances of
549-
non-atomic types (containers, user-defined objects...) are. However, some
550-
type-specific optimizations can be present in order to suppress the garbage
551-
collector footprint of simple instances. Historically, both dictionaries and
552-
tuples were untracked during garbage collection. Now it is only tuples:
553-
554-
- Tuples containing only immutable objects (integers, strings etc,
555-
and recursively, tuples of immutable objects) do not need to be tracked. The
556-
interpreter creates a large number of tuples, many of which will not survive
557-
until garbage collection. It is therefore not worthwhile to untrack eligible
558-
tuples at creation time. Instead, all tuples except the empty tuple are tracked
559-
when created. During garbage collection it is determined whether any surviving
560-
tuples can be untracked. A tuple can be untracked if all of its contents are
561-
already not tracked. Tuples are examined for untracking in all garbage collection
562-
cycles. It may take more than one cycle to untrack a tuple.
549+
non-atomic types (containers, user-defined objects...) are.
550+
551+
Tuples containing only immutable objects (integers, strings etc,
552+
and recursively, tuples of immutable objects) do not need to be tracked. The
553+
interpreter creates a large number of tuples, many of which will not survive
554+
until garbage collection. It is therefore not worthwhile to untrack eligible
555+
tuples at creation time. Instead, all tuples except the empty tuple are tracked
556+
when created. During garbage collection it is determined whether any surviving
557+
tuples can be untracked. A tuple can be untracked if all of its contents are
558+
already not tracked. Tuples are examined for untracking in all garbage collection
559+
cycles.
563560

564561
The garbage collector module provides the Python function `is_tracked(obj)`, which returns
565562
the current tracking status of the object. Subsequent garbage collections may change the

0 commit comments

Comments
 (0)