Title: Inconsistency handling of immortal objects in gc · Issue #137110 · python/cpython · GitHub
Open Graph Title: Inconsistency handling of immortal objects in gc · Issue #137110 · python/cpython
X Title: Inconsistency handling of immortal objects in gc · Issue #137110 · python/cpython
Description: Bug report Bug description: 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). cpyt...
Open Graph Description: Bug report Bug description: 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 G...
X Description: Bug report Bug description: 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 ...
Opengraph URL: https://github.com/python/cpython/issues/137110
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inconsistency handling of immortal objects in gc","articleBody":"# Bug report\n\n### Bug description:\n\nThere is some inconsistency in handling of immortal objects in default-build's GC.\n\nIn `update_refs` immortal objects just untracked (all immortal objects that we face in GC is an accidentally immortalized). https://github.com/python/cpython/blob/1e69cd1634e4f0f8c375be85d11925bd12deef23/Python/gc.c#L495-L500\n\n`update_refs` called for all collections (young, increment and full). But for incremental collection if `increment_size \u003c gcstate-\u003ework_to_do` we steal some objects from neighbor gen and call `expand_region_transitively_reachable` where immortal objects moved to permanent generation: https://github.com/python/cpython/blob/1e69cd1634e4f0f8c375be85d11925bd12deef23/Python/gc.c#L1397-L1402\n\nSo, one part of immortal objects can be untracked, and other part can be moved to perm gen. \n\nAs I understand from https://github.com/python/cpython/pull/127519 it is preferring to untrack immortal objects in all cases.\n\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\n_No response_\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-137111\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/sergey-miryanov","@type":"Person","name":"sergey-miryanov"},"datePublished":"2025-07-25T19:08:27.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/137110/cpython/issues/137110"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6c4d11e2-6b49-3773-5c33-a09a42ca8549 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 852C:2A6D10:1522FA:1ACFE7:696AD700 |
| html-safe-nonce | c1a0eb9276d759f484939f33d930b35165b0182fc5bc8fde371dc5309bc38d0b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NTJDOjJBNkQxMDoxNTIyRkE6MUFDRkU3OjY5NkFENzAwIiwidmlzaXRvcl9pZCI6IjEyNzg5NTQ0MjI1NzM2NTE3MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 42ca55208fce14f889c048fb04161b4952a320822c67490e9d2b265c491399f4 |
| hovercard-subject-tag | issue:3264133356 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/137110/issue_layout |
| twitter:image | https://opengraph.githubassets.com/39f8e708b6d90e09528f829ea967d98fe5a974ca79d0b4597f9975b40822b2ee/python/cpython/issues/137110 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/39f8e708b6d90e09528f829ea967d98fe5a974ca79d0b4597f9975b40822b2ee/python/cpython/issues/137110 |
| og:image:alt | Bug report Bug description: 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 G... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sergey-miryanov |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width