René's URL Explorer Experiment


Title: Memory leak on executables embedded with 3.13 · Issue #113055 · python/cpython · GitHub

Open Graph Title: Memory leak on executables embedded with 3.13 · Issue #113055 · python/cpython

X Title: Memory leak on executables embedded with 3.13 · Issue #113055 · python/cpython

Description: Bug report Bug description: Since 67807cf, _testembed.exe (x64 Release) increases the memory usage in the cycle of Py_Initialize and Py_Finalize. I monitored the Task Manager (taskmgr.exe) on Windows10/11, with a change against Programs/...

Open Graph Description: Bug report Bug description: Since 67807cf, _testembed.exe (x64 Release) increases the memory usage in the cycle of Py_Initialize and Py_Finalize. I monitored the Task Manager (taskmgr.exe) on Windo...

X Description: Bug report Bug description: Since 67807cf, _testembed.exe (x64 Release) increases the memory usage in the cycle of Py_Initialize and Py_Finalize. I monitored the Task Manager (taskmgr.exe) on Windo...

Opengraph URL: https://github.com/python/cpython/issues/113055

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Memory leak on executables embedded with 3.13","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nSince 67807cfc87135fdce4992d38d2ffe3e44747e73b, `_testembed.exe` (x64 Release) increases the memory usage in the cycle of `Py_Initialize` and `Py_Finalize`.\r\n\r\nI monitored the Task Manager (`taskmgr.exe`) on Windows10/11, with a change against `Programs/_testembed.c`:\r\n\r\n```c\r\n- #define INIT_LOOPS 4\r\n+ #define INIT_LOOPS 200\r\n```\r\nCommands:\r\n* `_testembed.exe test_repeated_simple_init` or\r\n* `python -m test test_embed -m test_simple_initialization_api` (no log)\r\n\r\nWith RADIX TREE (as-is)\r\n\r\n|Loop |67807cf|main|3.11.7|\r\n| :---: | :---: | :---: | :---: |\r\n| 100 | 67MB | 210MB | 4MB |\r\n| 200 | 135MB | 406MB | 4MB |\r\n\r\nNo RADIX TREE (as-is)\r\n\r\n|Loop |67807cf|main|3.11.7|\r\n| :---: | :---: | :---: | :---: |\r\n| 100 | 10MB | 168MB | 4MB |\r\n| 200 | 16MB | 336MB | 4MB |\r\n\r\nRecent `obmalloc.c` looks ready for finalization. Just adding my rough (invalid?) experiment made the leaks even. So, I hope that they share the same issue. Otherwise, ea2c0016502472aa8baa3149050ada776d17a009 or 15d4c9fabce67b8a1b5bd9dec9612014ec18291a has another leak. https://github.com/python/cpython/issues/98359#issuecomment-1847609983\r\n\u003cdetails\u003e\r\n\u003csummary\u003epatch\u003c/summary\u003e\r\n\r\n```c\r\nvoid\r\n_PyInterpreterState_FinalizeAllocatedBlocks(PyInterpreterState *interp)\r\n{\r\n    if (has_own_state(interp)) {\r\n        Py_ssize_t leaked = _PyInterpreterState_GetAllocatedBlocks(interp);\r\n        assert(has_own_state(interp) || leaked == 0);\r\n        interp-\u003eruntime-\u003eobmalloc.interpreter_leaks += leaked;\r\n\r\n+       OMState *state = \u0026interp-\u003eobmalloc;\r\n+       for (uint i = 0; i \u003c maxarenas; ++i) {\r\n+           if (allarenas[i].address == 0) {\r\n+               continue;\r\n+           }\r\n+           _PyObject_Arena.free(_PyObject_Arena.ctx,\r\n+                                (void *)allarenas[i].address, ARENA_SIZE);\r\n+           allarenas[i].address = 0;\r\n+           --narenas_currently_allocated;\r\n+       }\r\n+       PyMem_RawFree(allarenas);\r\n    }\r\n}\r\n```\r\n\r\n\u003c/details\u003e\r\n\r\nWith RADIX TREE (patched)\r\n\r\n|Loop |67807cf|main|\r\n| :---: | :---: | :---: |\r\n| 100 | 42MB | 40MB |\r\n| 200 | 80MB | 80MB |\r\n\r\nNo RADIX TREE (patched)\r\n\r\n|Loop |67807cf|main|\r\n| :---: | :---: | :---: |\r\n| 100 | 3.5M | 3.3M |\r\n| 200 | 3.7M | 3.4M |\r\n\r\n\r\ncc @ericsnowcurrently @nascheme\r\n\r\n### CPython versions tested on:\r\n\r\n3.12, 3.13, CPython main branch: 3aea6c4823e90172c9bc36cd20dc51b295d8a3c4\r\n\r\n### Operating systems tested on:\r\n\r\nWindows\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-113218\n* gh-113412\n* gh-118531\n* gh-118618\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/neonene","@type":"Person","name":"neonene"},"datePublished":"2023-12-13T14:08:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":20},"url":"https://github.com/113055/cpython/issues/113055"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8366eda1-1563-baa7-0b99-498f5573c2d5
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE282:3346BC:FC1F4C:158D7C9:6969F348
html-safe-nonce07ba82b73dcf15dbca698359170aaccfc2cdd0b056087055a1a9d7e2b1ebb6fb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjgyOjMzNDZCQzpGQzFGNEM6MTU4RDdDOTo2OTY5RjM0OCIsInZpc2l0b3JfaWQiOiI3MzEyODYxMjI2OTA1MjM2Mjk2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd4425706c2c4bf43379c84bec02189785f3169185f193086c8e82d289860e9ed
hovercard-subject-tagissue:2039792989
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/113055/issue_layout
twitter:imagehttps://opengraph.githubassets.com/24b91cd9d405c51f8b1bb5585682ed51f3475d73b8858a86ad01b55a09647b4e/python/cpython/issues/113055
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/24b91cd9d405c51f8b1bb5585682ed51f3475d73b8858a86ad01b55a09647b4e/python/cpython/issues/113055
og:image:altBug report Bug description: Since 67807cf, _testembed.exe (x64 Release) increases the memory usage in the cycle of Py_Initialize and Py_Finalize. I monitored the Task Manager (taskmgr.exe) on Windo...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameneonene
hostnamegithub.com
expected-hostnamegithub.com
None7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasebdde15ad1b403e23b08bbd89b53fbe6bdf688cad
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/113055#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F113055
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F113055
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/113055
Reloadhttps://github.com/python/cpython/issues/113055
Reloadhttps://github.com/python/cpython/issues/113055
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/113055
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/113055
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/113055
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/113055
Memory leak on executables embedded with 3.13https://github.com/python/cpython/issues/113055#top
pendingThe issue will be closed if no feedback is providedhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22pending%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/neonene
https://github.com/neonene
neonenehttps://github.com/neonene
on Dec 13, 2023https://github.com/python/cpython/issues/113055#issue-2039792989
67807cfhttps://github.com/python/cpython/commit/67807cfc87135fdce4992d38d2ffe3e44747e73b
67807cfhttps://github.com/python/cpython/commit/67807cfc87135fdce4992d38d2ffe3e44747e73b
67807cfhttps://github.com/python/cpython/commit/67807cfc87135fdce4992d38d2ffe3e44747e73b
ea2c001https://github.com/python/cpython/commit/ea2c0016502472aa8baa3149050ada776d17a009
15d4c9fhttps://github.com/python/cpython/commit/15d4c9fabce67b8a1b5bd9dec9612014ec18291a
#98359 (comment)https://github.com/python/cpython/issues/98359#issuecomment-1847609983
67807cfhttps://github.com/python/cpython/commit/67807cfc87135fdce4992d38d2ffe3e44747e73b
67807cfhttps://github.com/python/cpython/commit/67807cfc87135fdce4992d38d2ffe3e44747e73b
@ericsnowcurrentlyhttps://github.com/ericsnowcurrently
@naschemehttps://github.com/nascheme
3aea6c4https://github.com/python/cpython/commit/3aea6c4823e90172c9bc36cd20dc51b295d8a3c4
gh-113055: Fix memory leak of obmalloc state #113218https://github.com/python/cpython/pull/113218
gh-113055: Use pointer for interp->obmalloc state. #113412https://github.com/python/cpython/pull/113412
gh-118608: datetime: Fix use-after-free on embedded CPython #118531https://github.com/python/cpython/pull/118531
[3.12]: gh-113055: Use pointer for interp->obmalloc state #118618https://github.com/python/cpython/pull/118618
pendingThe issue will be closed if no feedback is providedhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22pending%22
topic-subinterpretershttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-subinterpreters%22
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
Subinterpretershttps://github.com/orgs/python/projects/3
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.