[Python-Dev] pyfailmalloc: new debug tool to test how your applications handles MemoryError (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Jul 9 01:39:14 CEST 2013


Hi,

The PEP 445 (Add new APIs to customize Python memory allocators) has been accepted, I commited its implementation. So it's time to have fun with this API.

I developed a small Python module (150 lines of C code) to inject memory allocation failures: https://pypi.python.org/pypi/pyfailmalloc

This module can be used to test your application under very low memory condition, test how your application handles MemoryError. I ran it in the Python test suite: Python core and stdlib do not handle MemoryError correctly everywhere...

I opened the following issue to track all bugs found by pytracemalloc and related commits to fix these bugs: http://bugs.python.org/issue18408

I already fixed bugs in PyObject_GC_NewVar(), PyDict_New(), list.pop(), type.bases setter, etc. I also found a bug in _PyMem_DebugRealloc(): a function supposed to detect bugs :-)

Have fun with this new tool on your applications and Python modules. Tell me if you would like to help me on issue #18408, there are still a lot of bugs to fix.

Victor



More information about the Python-Dev mailing list