[issue35056] Test leaks of memory not managed by Python allocator

STINNER Victor report at bugs.python.org
Fri Oct 26 06:39:25 EDT 2018


STINNER Victor <vstinner at redhat.com> added the comment:

It seems like the easiest thing to do thta would directly benefit (to tracemalloc users) is to continue the implementation of bpo-18227:

* _sqlite: call sqlite3_config(SQLITE_CONFIG_MALLOC, pMem) to use PyMem_RawMalloc()
* _ssl: try again CRYPTO_set_mem_functions()

Python modules already using Python memory allocators:

* zlib: "zst.zalloc = PyZlib_Malloc" which calls PyMem_RawMalloc
* _decimal: mpd_mallocfunc = PyMem_Malloc
* _lzma: "self->alloc.alloc = PyLzma_Malloc" which calls PyMem_RawMalloc
* pyexpat: XML_ParserCreate_MM(encoding, &ExpatMemoryHandler,...) with ExpatMemoryHandler = {PyObject_Malloc, PyObject_Realloc, PyObject_Free}
* _bz2: "bzalloc = BZ2_Malloc" which calls PyMem_RawMalloc()

Using Python memory allocators gives access to Python builtin "memory debugger", even in release mode using PYTHONMALLOC=debug or -X dev.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35056>
_______________________________________


More information about the Python-bugs-list mailing list