Garbage Collection
Implementation
Three-level generational scheme.
Newly created objects placed in generation 0.
Garbage collection step checks generation 0 and moves surviving objects to generation 1 (checked less frequently)
Objects surviving check of generation 1 move to generation 2.
Long-lived objects checked infrequently
The problem with __del__()
Classes that define a __del__() method are not collected
Placed on a list of uncollectable objects.
Problem: finalization
__del__() might reference the other object.
No way to determine proper order of destruction.
<<<
O'Reilly OSCON 2001, New Features in Python 2, Slide 30
July 26, 2001, beazley@cs.uchicago.edu
>>>