Episode 317: Demystifying Python Memory Management & Choosing a Project Layout
The Real Python Podcast
How does Python manage memory behind the scenes? What are the common ways to lay out a Python project? Christopher Trudeau is back on the show this week with another batch of PyCoder’s Weekly articles and projects.
Christopher shares an article titled “First Steps into Memory Management in Python.” With recent updates to the garbage collector and the ongoing work toward removing the Global Interpreter Lock (GIL), the article covers the fundamentals of how Python allocates, tracks, and frees memory.
We also share other articles and projects from the Python community, including recent releases, why Parquet dominates modern data engineering, choosing the right Python project layout, developing the most cursed + operator in all of Python, finding which dependencies block a Django project upgrade, and a Django performance benchmark profiler.
Spotlight: Codex for Python Developers: Hands-On Agentic Coding Course
Most Python developers use AI as fancy autocomplete. This 2-day live course teaches you to build entire projects with Codex, an AI agent that works inside your codebase.
Get Your Cheat Sheet: Click here to download your free Python project structure cheat sheet and keep the flat vs. src/ decision and the entry-point wiring within reach on your next project.
Topics:
- 00:00:00 – Introduction
- 00:01:56 – Python 3.16.0 Alpha 1 Is Now Available
- 00:02:24 – Django Security Releases Issued: 6.1.2, 6.0.9, and 5.2.18
- 00:02:46 – Release of Polars 2.0
- 00:03:32 – PyPy v8.0.1 Release
- 00:03:54 – Checking Email Reputation, and Allowing Outlook Again
- 00:04:48 – PyScript is in maintenance mode
- 00:05:55 – Codex for Python Developers: Hands-On Agentic Coding Course
- 00:06:21 – MLOps North: November 5th & 6th
- 00:06:46 – Why Parquet Dominates Modern Data Engineering
- 00:16:04 – First Steps Into Memory Management in Python
- 00:23:21 – Spotlight: Codex for Python Developers
- 00:25:05 – Python Project Structure: How to Choose the Right Layout
- 00:35:17 – Pendulum and the Most Cursed
+Operator in All of Python - 00:38:50 – django-benchmark: Django Performance Benchmark Profiler
- 00:41:53 – django-upgrade-report: Which Dependencies Block an Upgrade to Your Django Project?
- 00:44:33 – Thanks and goodbye
News:
- Python 3.16.0 Alpha 1 Is Now Available
- Django Security Releases Issued: 6.1.2, 6.0.9, and 5.2.18
- Release of Polars 2.0
- PyPy v8.0.1 Release
- Checking Email Reputation, and Allowing Outlook Again – Two years ago, PyPI prohibited Outlook email domains in the registration of new accounts due to a large malware campaign. With an update to how email reputation is calculated, addresses from
outlook.comandhotmail.comcan once more be used. - PyScript is in maintenance mode. Here’s what’s left for Python in the browser - DEV Community
- Codex for Python Developers: Hands-On Agentic Coding Course – Real Python
- MLOps North: Building (with) Agents Tickets, Thursday, November 5-Friday, November 6 • 8:30 AM-3 PM | Eventbrite
Show Links:
- Why Parquet Dominates Modern Data Engineering – How Parquet’s columnar layout, encodings, zstd compression, and row group statistics make it smaller and faster to read than CSV, measured on NYC taxi trips data with Polars, DuckDB, and PyArrow.
- First Steps Into Memory Management in Python – A quick introduction to how Python manages memory under the hood and how that might affect your code.
- Python Project Structure: How to Choose the Right Layout – Learn how to structure Python projects: pick between flat and
src/layouts, organize your code, and apply the patterns to CLI, web, and GUI apps. - Pendulum and the Most Cursed
+Operator in All of Python – Pendulum, a popular Python datetime library, has a + operator that inspects the call stack to decide which answer to give you. The post explains how it ended up there, and why the design behind it, a “drop-in” subclass of datetime, still matters for your code now that the hack itself has been patched.
Projects:
- django-benchmark: Django Performance Benchmark Profiler
- django-upgrade-report: Which Dependencies Block an Upgrade to Your Django Project?
Additional Links:
- PEP 848 – Generational Incremental Garbage Collection | peps.python.org
- Reverting the incremental GC in Python 3.14 and 3.15 - Core Development - Discussions on Python.org
- Garbage Collection: Python 3.15.2 documentation
- Memory Management in Python – Real Python
Want to go deeper on this episode? Mentor AI can explain the topics it covered and find tutorials to learn more.


