diff options
author | David Malcolm <dmalcolm@redhat.com> | 2012-06-22 18:55:41 (GMT) |
---|---|---|
committer | David Malcolm <dmalcolm@redhat.com> | 2012-06-22 18:55:41 (GMT) |
commit | 49526f48fc73d3ccdf09d466ed2d39a30e4df9b9 (patch) | |
tree | 51ac80c4d09ca4a537518555710423675a6ac731 /Objects/tupleobject.c | |
parent | 69cf913ba110de2eb773c030b1dd606456ac5831 (diff) | |
download | cpython-49526f48fc73d3ccdf09d466ed2d39a30e4df9b9.zip cpython-49526f48fc73d3ccdf09d466ed2d39a30e4df9b9.tar.gz cpython-49526f48fc73d3ccdf09d466ed2d39a30e4df9b9.tar.bz2 |
Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index d103b9b..013db69 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -45,6 +45,22 @@ show_track(void) } #endif +/* Print summary info about the state of the optimized allocator */ +void +_PyTuple_DebugMallocStats(FILE *out) +{ +#if PyTuple_MAXSAVESIZE > 0 + int i; + char buf[128]; + for (i = 1; i < PyTuple_MAXSAVESIZE; i++) { + PyOS_snprintf(buf, sizeof(buf), + "free %d-sized PyTupleObject", i); + _PyDebugAllocatorStats(out, + buf, + numfree[i], _PyObject_VAR_SIZE(&PyTuple_Type, i)); + } +#endif +} PyObject * PyTuple_New(register Py_ssize_t size) |