mirror of
https://github.com/python/cpython.git
synced 2025-10-29 01:22:59 +00:00
Issue #14954: Clarify the interaction of weak references and garbage collection.
Patch by Ethan Furman.
This commit is contained in:
parent
c6fdafcdf3
commit
9439f04b9a
2 changed files with 5 additions and 1 deletions
|
|
@ -24,7 +24,10 @@ by a weak reference.
|
||||||
A weak reference to an object is not enough to keep the object alive: when the
|
A weak reference to an object is not enough to keep the object alive: when the
|
||||||
only remaining references to a referent are weak references,
|
only remaining references to a referent are weak references,
|
||||||
:term:`garbage collection` is free to destroy the referent and reuse its memory
|
:term:`garbage collection` is free to destroy the referent and reuse its memory
|
||||||
for something else. A primary use for weak references is to implement caches or
|
for something else. However, until the object is actually destroyed the weak
|
||||||
|
reference may return the object even if there are no strong references to it.
|
||||||
|
|
||||||
|
A primary use for weak references is to implement caches or
|
||||||
mappings holding large objects, where it's desired that a large object not be
|
mappings holding large objects, where it's desired that a large object not be
|
||||||
kept alive solely because it appears in a cache or mapping.
|
kept alive solely because it appears in a cache or mapping.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -317,6 +317,7 @@ Jim Fulton
|
||||||
Tadayoshi Funaba
|
Tadayoshi Funaba
|
||||||
Gyro Funch
|
Gyro Funch
|
||||||
Peter Funk
|
Peter Funk
|
||||||
|
Ethan Furman
|
||||||
Geoff Furnish
|
Geoff Furnish
|
||||||
Ulisses Furquim
|
Ulisses Furquim
|
||||||
Hagen Fürstenau
|
Hagen Fürstenau
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue