PEP 683: Immortal Objects - A new approach for memory managing
summary
PEP 683 marks common runtime constants as Immortal objects by setting their refcount to a sentinel and making INCREF/DECREF no-ops for them. Concrete results: reduced memory growth under heavy request loads and higher shared memory in pre-fork setups (Instagram measurements), with about a 2% CPU cost in some hotspots. Examples made immortal: None True False empty string and small ints −5..256. Work required: C‑level changes, cross‑platform compatibility, risk of accidental immortality and tradeoffs for copy‑on‑write and GIL‑related designs.
AI-written summary · about
chapters (14)
- 0:00PEP 683 Immortal Objects intro
- 1:24Python memory basics
- 5:21Reference counting in threads
- 6:44PEP 683 goals
- 9:33CPU cache invalidation
- 10:57Copy-on-write issues
- 13:04Immortal objects explained
- 13:45Immortal objects implementation
- 15:55Performance impact of immortal objects
- 16:37Immortal objects risks
- 17:41Compatibility and trade-offs
- 18:45Future PEPs and apps
- 21:13PEP 703 GIL optional
- 23:01Q&A thread safety
related talks
35mPEP 683: Immortal Objects - A new approach for memory managing
31mIntroducing Immortal Objects: Building Block Towards a Multi-core Python Runtime
23mMemoirs of a Python Object: Memory Management and Improving Performance
19mDynamically Checked Deep Immutability in Python
25mIs it me or Python memory management? 🤔💻
01h 18mPython 103: Mmmm... Understanding Python's Memory Model, Mutability, and Methods
32mDesigning With Immutability
01h 32mPyErlang -- a stepping stone towards behaviour-oriented concurrency in Python
