STINNER Victor added the comment: 2013/7/17 Charles-François Natali <rep...@bugs.python.org>: > Victor, how about adding pyfailmalloc to the main repo (maybe under Tools), > with a script making it easy to run the tests suite with it enabled? > This way, it'll make it easier to run it from time to time (one could eve > imagine making it part of the test suite at some point, but that's another > story...).
I plan to write a new module and propose it for inclusion in Python 3.4. It will have the features of pytracemalloc *and* pyfailmalloc, and also statistics (number of calls to each allocator function, with a function to reset counters). The blocker pointer is to get the size of a buffer on free(). In pytracemalloc, I'm using a glib hash lib: pointer => structure {size of the buffer, filename, line number}. The dependency to glib should be removed to integrate the module in Python :-) The simpler solution is to allocate a wider buffer and store the metadata directly in the buffer before the data. The second problem is how this feature would be enabled. Enabling the feature at runtime would require a new environment variable to set the right memory allocator at startup. The choice of the memory allocator must be done before the first memory allocation, so in main(). Integrating pytracemalloc into CPython was my main motivation to write the PEP 445. If you would like to use pyfailmalloc right now, you have to: * build pyfailmalloc with Python 3.4 * apply debug_cpython.patch on Python which is the pyfailmalloc repository * run gdb -x debug_cpython.gdb (which can also be found in the pyfailmalloc repository) * https://bitbucket.org/haypo/pyfailmalloc ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18408> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com