[issue26249] Change PyMem_Malloc to use pymalloc allocator

STINNER Victor report at bugs.python.org
Wed Mar 9 12:27:09 EST 2016


STINNER Victor added the comment:

> I'm talking about the performance improvement in third-party libraries, not the performance improvement in CPython itself which can be addressed by replacing the internal API calls.

Oh ok. I don't know how to measure the performance of third-party libraries. I expect no speedup or a little speedup, but no slow-down.


> Do you think it's reasonable to risk breaking external libraries just
for a hypothetic "performance improvement"?

The question is if my change really breaks anything in practice. I'm testing some popular C extensions to prepare an answer. Early results is that developer use correctly the Python allocator API :-)

I disagree on the fact that my change breaks any API. The API doc is clear. For example, you must use PyMem_Free() on memory allocated by PyMem_Malloc(). If you use free(), it fails badly with Python compiled in debug mode.

My issue #26516 "Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode" may help developers to validate their own application.

I suggest you to continue the discussion on python-dev for a wider audience. I will test a few more projects before replying on the python-dev thread.

----------

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


More information about the Python-bugs-list mailing list