Title: Memory leaks in free-threaded build at shutdown · Issue #122697 · python/cpython · GitHub
Open Graph Title: Memory leaks in free-threaded build at shutdown · Issue #122697 · python/cpython
X Title: Memory leaks in free-threaded build at shutdown · Issue #122697 · python/cpython
Description: Bug report The -X showrefcount isn't reporting leaked blocks on exit and we're hiding some leaked objects on shutdown. Note that we're still able to catch most leaks via the refleaks test. -X showrefcount _Py_GetGlobalAllocatedBlocks() i...
Open Graph Description: Bug report The -X showrefcount isn't reporting leaked blocks on exit and we're hiding some leaked objects on shutdown. Note that we're still able to catch most leaks via the refleaks test. -X showr...
X Description: Bug report The -X showrefcount isn't reporting leaked blocks on exit and we're hiding some leaked objects on shutdown. Note that we're still able to catch most leaks via the refleaks te...
Opengraph URL: https://github.com/python/cpython/issues/122697
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Memory leaks in free-threaded build at shutdown","articleBody":"# Bug report\n\nThe `-X showrefcount` isn't reporting leaked blocks on exit and we're hiding some leaked objects on shutdown. Note that we're still able to catch most leaks via the refleaks test.\n\n### -X showrefcount\n\n`_Py_GetGlobalAllocatedBlocks()` is returning zero because the main interpreter is already `NULL`. This works in the default build because we've stashed away the number of leaked blocks in `_PyRuntime.obmalloc.interpreter_leaks`. We should do the same thing in the free-threaded build by updating `_PyInterpreterState_FinalizeAllocatedBlocks()`.\n\n### Leaked objects on exit\n\nSome objects that are referenced by global modules and use deferred reference counting are leaked on exit. Objects that use deferred reference counting are only collected by the GC. However, these object still have valid, live references when we run the GC for the final time. For example, one leaked object is a `member_descriptor` whose last reference is removed in `clear_static_type_objects`.\n\nI think we'll cause too many problems if we try to invoke the GC later. Instead, I think that the free-threaded GC should disable deferred reference counting on all objects when its invoked for the final time.\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-122703\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/colesbury","@type":"Person","name":"colesbury"},"datePublished":"2024-08-05T17:53:29Z","url":"https://github.com/python/cpython/issues/122697"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:56e66e77-56c4-4f4e-cfab-142143392ce6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ADF6:2E124E:40B10F7:528E736:6B022F59 |
| html-safe-nonce | 94c29470e70c7e5aca2e9f294af01e59380e2ad31d6c7ad5cdcf45c67eb06eaf |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBREY2OjJFMTI0RTo0MEIxMEY3OjUyOEU3MzY6NkIwMjJGNTkiLCJ2aXNpdG9yX2lkIjoiMzIxNTY2ODc4Njg0MTY2MTI3MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e11e23b0e5036d2be1261161d3093dd5814ad03aea59121310db1693c4cd3fa0 |
| hovercard-subject-tag | issue:2449149946 |
| 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/122697/issue_layout |
| twitter:image | https://opengraph.githubassets.com/efeeaa49b789ca222b7600685307a39d98b30d40b7d1deb38b02d7ddb628adfd/python/cpython/issues/122697 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/efeeaa49b789ca222b7600685307a39d98b30d40b7d1deb38b02d7ddb628adfd/python/cpython/issues/122697 |
| og:image:alt | Bug report The -X showrefcount isn't reporting leaked blocks on exit and we're hiding some leaked objects on shutdown. Note that we're still able to catch most leaks via the refleaks test. -X showr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | colesbury |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width