diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-15 22:22:13 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-15 22:22:13 +0100 |
| commit | 0611c26a58a937dace420691e797fbea21db619b (patch) | |
| tree | 20f6c60f778a2e999d299b3b015f01d83a10eb4d /Objects/obmalloc.c | |
| parent | af584a02a5dee4250e904ff75d22359aee9c2d70 (diff) | |
| download | cpython-git-0611c26a58a937dace420691e797fbea21db619b.tar.gz | |
On memory error, dump the memory block traceback
Issue #26564: _PyObject_DebugDumpAddress() now dumps the traceback where a
memory block was allocated on memory block. Use the tracemalloc module to get
the traceback.
Diffstat (limited to 'Objects/obmalloc.c')
| -rw-r--r-- | Objects/obmalloc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index f526b1ff20..8812f592b6 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1,5 +1,10 @@ #include "Python.h" + +/* Defined in tracemalloc.c */ +extern void _PyMem_DumpTraceback(int fd, const void *ptr); + + /* Python's malloc wrappers (see pymem.h) */ /* @@ -2202,6 +2207,10 @@ _PyObject_DebugDumpAddress(const void *p) } fputc('\n', stderr); } + fputc('\n', stderr); + + fflush(stderr); + _PyMem_DumpTraceback(fileno(stderr), p); } |
