Confessions of a Code Addict

Confessions of a Code Addict

Share this post

Confessions of a Code Addict
Confessions of a Code Addict
Live Session: CPython Memory Management Internals
Copy link
Facebook
Email
Notes
More

Live Session: CPython Memory Management Internals

Learn how CPython manages the memory of your programs

Abhinav Upadhyay's avatar
Abhinav Upadhyay
Apr 30, 2024
∙ Paid
5

Share this post

Confessions of a Code Addict
Confessions of a Code Addict
Live Session: CPython Memory Management Internals
Copy link
Facebook
Email
Notes
More
2
Share

Last week we concluded the live session on the internals of the CPython’s main bytecode interpreter (the VM), and the response from the attendees has been very encouraging.

Next, I want to talk about how CPython implements memory management in its runtime. Most programming languages with managed runtimes use a conventional tracing garbage collector (GC), however, CPython uses a combination of reference counting and a conventional GC. We will cover how it does that and the following details:

  • What is reference counting?

  • How CPython implements reference counting (with walk through of relevant CPython code)

  • In what cases reference counting doesn’t work?

  • How CPython’s garbage collector works?

  • The changes in reference counting and GC implementation as part of the GIL (global interpreter lock) removal work

    • Biased reference counting

    • Immortal object

Prerequisites

You don’t need to have attended the previous CPython sessions to understand this. It will be totally independent of past sessions.

However, some passing understanding of C syntax will be useful, namely structs and pointers.

Date & Time

May 12th, 2024 16:30 - 18:00 UTC

Logistics

As always the session and recording is free for the paid subscribers. So to access it simply upgrade your subscription.

Registration Link

You can register at the below link:

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 Abhinav Upadhyay
Publisher Privacy ∙ Publisher Terms
Substack
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More