Object Destruction

Python
Author

Imad Dabbura

Published

December 1, 2022

Every Python object has a refcount integer field that counts how many objects/variables are pointing towards it within the program.

Once the refcount reaches zero or the object becomes unreachable (determined by mark-sweep algorithm used by the garbage collector)