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
tracemalloc add a memory limit feature #64016
Comments
It would be nice to add a memory_limit feature to the tracemalloc to make memory allocation fails if it would make the traced memory greater than the limit. See also the pyfailmalloc project which is similar but different: pyfailmalloc doesn't count allocated bytes, it schedules an error in N allocations where N is a random number. And pyfailmalloc only schedules one error, whereas I propose to make all memory allocations fails until the limit is respected. So if you only 0 bytes free (according to the limit), all memory allocations fail until some bytes are freed. Python currently behaves badly under very low memory condition. See also the issue bpo-19437. |
This feature cannot be used without a reliable PyErr_NoMemory(): I add issue bpo-19835 as a dependency. |
Updated patch. |
test_limit.patch: Patch to test the memory_limit on the Python test suite. tracemalloc_memory_limit-2.patch and unittest_leak.patch (of issue bpo-19880) are required to test it. |
New changeset 45442f2a2494 by Victor Stinner in branch 'default': |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: