[issue35053] Enhance tracemalloc to trace properly free lists

STINNER Victor report at bugs.python.org
Wed Oct 24 08:19:05 EDT 2018


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

A little bit of history.

I opened a bug 2 years ago but I closed it (lack of interest):
https://github.com/vstinner/pytracemalloc/issues/2

I rewrote tracemalloc between version 0.9 and 1.0. In tracemalloc 0.9, there was an API to track free lists. Here is the code to handle "alloc" and "free" of an object inside a freelist:

https://github.com/vstinner/pytracemalloc/blob/a2b2616fc73cd5ce0ea45d1b68a490e0fc52ccc8/_tracemalloc.c#L291-L337

My PR 10063 has a more correct and efficient implementation:

* It keeps the trace alive when the object moves into the free list to report the real memory usage of Python: the free lists consumes memory
* It writes directly into the hash table entry rather than remove/add frequently the trace, it should be more efficient

----------

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


More information about the Python-bugs-list mailing list