Episode 21: A Garbage Episode

Episode 21: A Garbage Episode

From core.py by Pablo Galindo and Łukasz Langa

April 17, 2025 · 1h 58m · Season 1 · Episode 21

About this episode

The episode covers various aspects of garbage collection in Python, including reference counting and free-threading.

We talked about this episode for months now, and it's finally here. Garbage collection in its full glory. Classic and free-threaded. Generational and single-pass. With eager and delayed untracking. We cover it all! Explicitly. ## Timestamps (00:00:00) THE FUCKING INTRO (00:02:03) PART 0: SPORTS NEWS (00:03:19) PART 1: GARBAGE COLLECTION (00:03:57) The big problem with refcounting (00:08:35) Solving reference cycles through PyGC_Head (00:11:45) 64 bits ought to be enough for anybody (00:17:30) Why a doubly-linked list? (00:21:15) How reference counting makes finding cycles easier (00:26:25) Roots bloody roots (00:30:17) How are objects in the cycle destroyed? (00:31:58) Object resurrection (00:43:21) Why do you need "generations"? (00:52:26) Delayed untracking (00:54:46) Weak references, strong problems (00:59:19) GC in free threading (01:03:27) Reference counting in free-threading builds (01:10:08) Incremental GC talk is DEFERRED (01:11:00) PART 2: PR OF THE WEEK (01:17:15) Type checking the standard library itself? (01:29:51) PART 3: WHAT'S GOING ON IN CPYTHON? (01:30:15) Free-threading changes (01:32:54) Performance updates (01:36:11) http.server supports HTTPS…

People in this episode

Hosts: Pablo Galindo, Łukasz Langa

Topics covered

  • garbage collection
  • reference counting
  • free-threading
  • CPython updates
  • performance improvements
  • weak references

Keywords

  • garbage collection
  • reference cycles
  • free-threading
  • CPython
  • performance updates
  • weak references
  • PEP 768
  • bugfixes

Mentioned in this episode

Books & works: Episode 21: A Garbage Episode

More episodes of core.py

Explore listener stats, chart rankings, contacts and more on the core.py podcast page.