-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Py_Initialize()
still leaks in libpython3.11
#100773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @vstinner who worked on removing the startup leakages as far as I remember :) |
Leaking detected by Address Santitizer as well:
|
It's different if memory is allocated exactly once and never released explicitly by Py_Finalize(), or if each Py_Initialize() call allocates new memory. Most of remaining "leaks" are memory allocated exactly once and then never released by Py_Finalize(). There is still a work-in-progress to convert remaining stdlib extensions to multi-phase initialization. A recent example with _elementtree: fee7a99 If you are curious, you should dig into the pymain_free() function of Modules/main.c to see memory not freed by Py_Finalize(), but freed by Py_RunMain(). |
Python 3.12 arrived with plenty of new sanitizer-reported errors :-( |
Bug Report
The following code leaks several hundred kilobytes with the latest libpython from the Ubuntu APT repository:
With libpython3.10, it consistently leaks 480 KB, whereas with libpython3.11, it consistently leaks 408 KB. (These are proper IEC power-of-10 kilobytes, not power-of-2 kibibytes.) I’ve verified this by running this code as a Clang-compiled dynamic executable through Valgrind.
Binary Images
libpython3.10 version:
libpython3.11 version:
Valgrind Reports
Environment
(Both from the Ubuntu APT repository)
The text was updated successfully, but these errors were encountered: