[issue26516] Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode

STINNER Victor report at bugs.python.org
Wed Mar 9 09:25:58 EST 2016


STINNER Victor added the comment:

When I wrote the PEP 445, I already proposed to add a new environment variable to install debug hooks on a Python compiled in release mode:

https://www.python.org/dev/peps/pep-0445/#add-a-new-pydebugmalloc-environment-variable

But the proposition was rejected because of the PEP 432, but 3 years later, this PEP is still stuck at the draft state. So I propose to move on.

Anyway, PYTHONMALLOC is really a corner case since it must be read *very early* (first instruction of main()).


Oh by the way, I forgot to explain the initial motivation for this change! It's the issue #26249: "Change PyMem_Malloc to use pymalloc allocator". With this change, applications misuing PyMem_Malloc API (ex: alloc memory with PyMem_Malloc(), free memory with free()) will start to crash. PYTHONMALLOC=debug should help these applications to detect bugs easier and get an obvious error message.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26516>
_______________________________________


More information about the Python-bugs-list mailing list