Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 609939e

Browse files
committed
Issue #14954: Clarify the interaction of weak references and garbage collection.
Patch by Ethan Furman.
2 parents 77ebfcc + 9439f04 commit 609939e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Doc/library/weakref.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ by a weak reference.
2424
A weak reference to an object is not enough to keep the object alive: when the
2525
only remaining references to a referent are weak references,
2626
:term:`garbage collection` is free to destroy the referent and reuse its memory
27-
for something else. A primary use for weak references is to implement caches or
27+
for something else. However, until the object is actually destroyed the weak
28+
reference may return the object even if there are no strong references to it.
29+
30+
A primary use for weak references is to implement caches or
2831
mappings holding large objects, where it's desired that a large object not be
2932
kept alive solely because it appears in a cache or mapping.
3033

0 commit comments

Comments
 (0)