tubeshowcase●1,194,391 videos♡ My collection 0
← Learn to Code

Learn to Code27:52

Memory management in CPython, fast or slow? - Mark Shannon

PyCon US ↗

From the creator

When considering Python performance, memory management often gets less attention than features like free-threading or the JIT compiler. Yet, roughly a third of the runtime of a typical Python program is spent performing memory management. Understanding how CPython allocates, tracks, and frees memory is important for understanding Python performance. Most Python developers know that CPython uses reference counting to determine when objects can be freed. But that’s only one part of a much more intricate system. Behind the scenes, CPython must also: - Allocate memory for new objects quickly and efficiently - Return freed memory back to the system or to internal allocators for reuse - Detect and collect cyclic references, which reference counting alone cannot handle; CPython includes a dedicated cycle detector to ensure these objects are eventually freed In this talk, I will: - Trace the lifetime of a Python object through the lens of memory management - Examine the time and space costs associated with each component of memory management - Highlight improvements made in recent CPython releases, and discuss future opportunities to further reduce these costs

Published 2026-08-25 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.

Keep exploring Learn to Code