MemotivaVariables, references, and memory model

What is reference counting in Python?

Variables, references, and memory model

Audio flashcard · 0:14

Nortren·

What is reference counting in Python?

0:14

Reference counting is the primary memory management mechanism in CPython. Every object has an internal counter of how many references point to it. When the count drops to zero, the object is immediately deallocated. This makes most memory management deterministic and predictable.
docs.python.org