diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-14 12:04:26 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-14 12:04:26 +0100 |
commit | d2f995ca30b1a4ec4bd04857fa7d3440dd373ec6 (patch) | |
tree | f299d73b0942b2a6fc6335d15a0997055f7d489e /Python/sysmodule.c | |
parent | fb4d4b905835c1da1318028f54f441970131c80f (diff) | |
download | cpython-d2f995ca30b1a4ec4bd04857fa7d3440dd373ec6.tar.gz |
Add PYTHONMALLOC env var
Issue #26516:
* Add PYTHONMALLOC environment variable to set the Python memory
allocators and/or install debug hooks.
* PyMem_SetupDebugHooks() can now also be used on Python compiled in release
mode.
* The PYTHONMALLOCSTATS environment variable can now also be used on Python
compiled in release mode. It now has no effect if set to an empty string.
* In debug mode, debug hooks are now also installed on Python memory allocators
when Python is configured without pymalloc.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 702e8f0f9f..c5b4ac1ae9 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1151,8 +1151,10 @@ static PyObject * sys_debugmallocstats(PyObject *self, PyObject *args) { #ifdef WITH_PYMALLOC - _PyObject_DebugMallocStats(stderr); - fputc('\n', stderr); + if (_PyMem_PymallocEnabled()) { + _PyObject_DebugMallocStats(stderr); + fputc('\n', stderr); + } #endif _PyObject_DebugTypeStats(stderr); |