Forward-port generational GC
Feature or enhancement
Proposal:
It was decided to revert the incremental GC and restore the generational GC from Python 3.13.
After discussing with @nascheme, we plan to forward-port the generational GC from 3.13 with minimal changes.
Here is the plan:
3.14
- Forward-port the generational GC from 3.13 with minimal changes
- Backport the
heap_sizecalculation logic
3.15
- Forward port from 3.14
- Backport weakref's callbacks changes (b6b99bf, 350c58b, 654b8d9)
- Backport changes required for pystats (c98c5b3)
- Backport GC frame for Tachyon (336366f)
- Backport extended data for callbacks: duration, candidates (598d4c6, 227b9d3)
- Backport gc-stats from external processes (Add a module for monitoring GC statistics #146527)
AFAICT, these are all the changes that need to be forward-ported or backported for the 3.14 and 3.15.
Has this already been discussed elsewhere?
I have already discussed this feature proposal on Discourse
Links to previous discussion of this feature:
https://discuss.python.org/t/reverting-the-incremental-gc-in-python-3-14-and-3-15/107014
Linked PRs
- [3.14] GH-148726: Forward-port generational GC #148720
- GH-148726: Forward-port generational GC. #148746
- [3.14] GH-148726: Forward-port generational GC (another way) #148772
- [3.14] GH-148726: Add heap_size to _gc_runtime_state #149025
- GH-148726: Add heap_size to generational GC #149195
- gh-148726: Document the GC change in What's New in Python 3.14 #149209
- [3.14] gh-148726: Document the GC change in What's New in Python 3.14 (GH-149209) #149249
- gh-148726: Add gc changes to What's New #149398