[Python-Dev] Add a new tracemalloc module to trace memory allocations

Victor Stinner victor.stinner at gmail.com
Thu Aug 29 15:54:38 CEST 2013


2013/8/29 Brett Cannon <brett at python.org>:
>> I also created a "pyfailmalloc" project based on the PEP 445 to inject
>> MemoryError exceptions. (...)
>
> Would extension module authors find it useful?

I don't know, I created two months ago and I didn't made a public annoucement.

> If so maybe we need a malloc package with trace and fail submodules?

I read somewhere "flat is better than nested". failmalloc and
tracemalloc are not directly related. I guess that they can be used at
the same time, but I didn't try.

> And if we add it we might want to add to running the tool as part of the
> devguide something people can work on.

There are still tricky open issues related to failmalloc :-)

- frame_fasttolocals.patch: fix for PyFrame_FastToLocals(), I didn't
commit the patch because it is not atomic (it does not handle errors
correctly). I should modify it to copy the locals before modifying the
dict, so it can be restored in case of errors.
- #18507: import_init() should not use Py_FatalError() but return an error
- #18509: CJK decoders should return MBERR_EXCEPTION on PyUnicodeWriter error
- fix tests hang when an exception occurs in a thread

Victor


More information about the Python-Dev mailing list