diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-14 11:04:26 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-14 11:04:26 (GMT) |
commit | 34be807ca4dfecc5b0a9e577a48535e738dce32b (patch) | |
tree | 38e0e3860b3fabf2be4938330a1d0f37c5b169ab /Python/sysmodule.c | |
parent | c877658d1ff5f93f3a2c7b5f0a7ac913b7374838 (diff) | |
download | cpython-34be807ca4dfecc5b0a9e577a48535e738dce32b.zip cpython-34be807ca4dfecc5b0a9e577a48535e738dce32b.tar.gz cpython-34be807ca4dfecc5b0a9e577a48535e738dce32b.tar.bz2 |
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 702e8f0..c5b4ac1 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); |