gh-137110: Untrack immortal objects from expand_region_transitivity_reachable #137111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is some inconsistency in handling of immortal objects in default-build's GC.
In
update_refs
immortal objects just untracked (all immortal objects that we face in GC is an accidentally immortalized).cpython/Python/gc.c
Lines 495 to 500 in 1e69cd1
update_refs
called for all collections (young, increment and full). But for incremental collection ifincrement_size < gcstate->work_to_do
we steal some objects from neighbor gen and callexpand_region_transitively_reachable
where immortal objects moved to permanent generation:cpython/Python/gc.c
Lines 1397 to 1402 in 1e69cd1
So, one part of immortal objects can be untracked, and other part can be moved to perm gen.
As I understand from #127519 it is preferring to untrack immortal objects in all cases.
CPython versions tested on:
CPython main branch