CPython's cyclic garbage collector (was [Python-ideas] Automatic context managers)
Dave Angel
davea at davea.name
Fri Apr 26 19:45:50 EDT 2013
On 04/26/2013 06:43 PM, Ian Kelly wrote:
<SNIP>
>
> Whenever the GC finds a cycle that is unreferenced but uncollectable,
> it stores those objects in the list gc.garbage. At that point, if the
> user wishes to clean up those cycles, it is up to them to delve into
> gc.garbage, untangle the objects contained within, break the cycles,
> and remove them from the list so that they can be freed by the ref
> counter. This user-supplied step is what Chris is referring to as
> "some other" periodic check. If the user does not do this, then those
> objects simply remain in the gc.garbage list until the program
> terminates.
>
I didn't know there was a callback that a user could hook into. That's
very interesting.
--
DaveA
More information about the Python-list
mailing list