diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-10-25 11:31:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 11:31:16 (GMT) |
commit | 9e00e80e213ebc37eff89ce72102c1f928ebc133 (patch) | |
tree | 50b24d69615a7994aeb4d776adc8666fcec5aafd /Objects/obmalloc.c | |
parent | d7c3e5f0e89cb807093e33165815c8bbd3c00f4b (diff) | |
download | cpython-9e00e80e213ebc37eff89ce72102c1f928ebc133.zip cpython-9e00e80e213ebc37eff89ce72102c1f928ebc133.tar.gz cpython-9e00e80e213ebc37eff89ce72102c1f928ebc133.tar.bz2 |
bpo-35053: Enhance tracemalloc to trace free lists (GH-10063)
tracemalloc now tries to update the traceback when an object is
reused from a "free list" (optimization for faster object creation,
used by the builtin list type for example).
Changes:
* Add _PyTraceMalloc_NewReference() function which tries to update
the Python traceback of a Python object.
* _Py_NewReference() now calls _PyTraceMalloc_NewReference().
* Add an unit test.
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r-- | Objects/obmalloc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index d58da35..fbc9478 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -63,6 +63,12 @@ static void* _PyObject_Realloc(void *ctx, void *ptr, size_t size); #endif +/* bpo-35053: Declare tracemalloc configuration here rather than + Modules/_tracemalloc.c because _tracemalloc can be compiled as dynamic + library, whereas _Py_NewReference() requires it. */ +struct _PyTraceMalloc_Config _Py_tracemalloc_config = _PyTraceMalloc_Config_INIT; + + static void * _PyMem_RawMalloc(void *ctx, size_t size) { |