Blogs / Why Python Has Both Reference Counting and a Garbage Collector

Why Python Has Both Reference Counting and a Garbage Collector

What reference counting already does in Python, what the write-up says is left for the garbage collector and why it calls a comparison with other languages unfair.

  • Learning
  • 1 min read

For: Learners curious about Python memory management.

Which mechanism does the main work

Funnily enough, this ~12% of time spent is not Python’s primary garbage collection mechanism; reference counting is.[1]

Reference countingPython's primary mechanismGarbage collectora backupbacked up by
Which mechanism is primary in Python, and which is the backup?

Why a comparison is unfair

Mark noted that direct comparison between other programming language garbage collectors and Python would be “unfair”, because “nobody else does reference-counting and garbage collection”.[1]

Sources

  1. Garbage Collection: Generational? Incremental? Both! (Python Language Summit 2026) (blog.python.org · checked )

More articles