This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2020-05-26.14:48:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I never used sys._debugmallocstats() function or PYTHONMALLOCSTATS environment variable, whereas I spend significant time on optimizing memory allocators and free lists. The output is written into stderr which is very convenient to process these data.

I only "re"-discovered recently this debug feature when writing PR 20247 "Make tuple free list per-interpreter": I had to update _PyTuple_DebugMallocStats().

Removing this debug feature reduces the maintenance burden.

Attached PR removes all code related to the sys._debugmallocstats() function and the PYTHONMALLOCSTATS environment variable.

If someone wants to hack Python memory allocators or free lists, I suggest to add temporary code to dump some stats. But I don't think that it's worth it to keep the feature for all uses in Python.

People who worry about the memory usage of their application don't have to go into this low level of details, but care more about memory peak, where the memory was allocated (ex: tracemalloc module), RSS memory, etc.
Date User Action Args
2020-05-26 14:48:52vstinnersetrecipients: + vstinner
2020-05-26 14:48:52vstinnersetmessageid: <>
2020-05-26 14:48:52vstinnerlinkissue40781 messages
2020-05-26 14:48:52vstinnercreate