summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2012-06-22 18:55:41 (GMT)
committerDavid Malcolm <dmalcolm@redhat.com>2012-06-22 18:55:41 (GMT)
commit49526f48fc73d3ccdf09d466ed2d39a30e4df9b9 (patch)
tree51ac80c4d09ca4a537518555710423675a6ac731 /Include
parent69cf913ba110de2eb773c030b1dd606456ac5831 (diff)
downloadcpython-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 'Include')
-rw-r--r--Include/dictobject.h1
-rw-r--r--Include/floatobject.h2
-rw-r--r--Include/frameobject.h2
-rw-r--r--Include/listobject.h1
-rw-r--r--Include/methodobject.h5
-rw-r--r--Include/object.h8
-rw-r--r--Include/objimpl.h4
-rw-r--r--Include/setobject.h1
-rw-r--r--Include/tupleobject.h3
9 files changed, 26 insertions, 1 deletions
diff --git a/Include/dictobject.h b/Include/dictobject.h
index d908524..d89aac8 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -111,6 +111,7 @@ PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
#ifndef Py_LIMITED_API
int _PyObjectDict_SetItem(PyTypeObject *tp, PyObject **dictptr, PyObject *name, PyObject *value);
PyObject *_PyDict_LoadGlobal(PyDictObject *, PyDictObject *, PyObject *);
+PyAPI_FUNC(void) _PyDict_DebugMallocStats(FILE *out);
#endif
#ifdef __cplusplus
diff --git a/Include/floatobject.h b/Include/floatobject.h
index 46ef6e6..e240fdb 100644
--- a/Include/floatobject.h
+++ b/Include/floatobject.h
@@ -110,6 +110,8 @@ PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le);
/* free list api */
PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
+PyAPI_FUNC(void) _PyFloat_DebugMallocStats(FILE* out);
+
/* Format the object based on the format_spec, as defined in PEP 3101
(Advanced String Formatting). */
PyAPI_FUNC(int) _PyFloat_FormatAdvancedWriter(
diff --git a/Include/frameobject.h b/Include/frameobject.h
index a8df445..ac2f790 100644
--- a/Include/frameobject.h
+++ b/Include/frameobject.h
@@ -79,6 +79,8 @@ PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *);
PyAPI_FUNC(int) PyFrame_ClearFreeList(void);
+PyAPI_FUNC(void) _PyFrame_DebugMallocStats(FILE *out);
+
/* Return the line of code the frame is currently executing. */
PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *);
diff --git a/Include/listobject.h b/Include/listobject.h
index 6fd374b..dc62aee 100644
--- a/Include/listobject.h
+++ b/Include/listobject.h
@@ -64,6 +64,7 @@ PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *);
PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *);
PyAPI_FUNC(int) PyList_ClearFreeList(void);
+PyAPI_FUNC(void) _PyList_DebugMallocStats(FILE *out);
#endif
/* Macro, trading safety for speed */
diff --git a/Include/methodobject.h b/Include/methodobject.h
index 0eabbb7..3cc2ea9 100644
--- a/Include/methodobject.h
+++ b/Include/methodobject.h
@@ -82,6 +82,11 @@ typedef struct {
PyAPI_FUNC(int) PyCFunction_ClearFreeList(void);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _PyCFunction_DebugMallocStats(FILE *out);
+PyAPI_FUNC(void) _PyMethod_DebugMallocStats(FILE *out);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/object.h b/Include/object.h
index e341532..68001e7 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -977,6 +977,14 @@ PyAPI_DATA(PyObject *) _PyTrash_delete_later;
else \
_PyTrash_deposit_object((PyObject*)op);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void)
+_PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks,
+ size_t sizeof_block);
+PyAPI_FUNC(void)
+_PyObject_DebugTypeStats(FILE *out);
+#endif /* ifndef Py_LIMITED_API */
+
#ifdef __cplusplus
}
#endif
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 8fc3fc1..b1a624c 100644
--- a/Include/objimpl.h
+++ b/Include/objimpl.h
@@ -101,13 +101,15 @@ PyAPI_FUNC(void) PyObject_Free(void *);
/* Macros */
#ifdef WITH_PYMALLOC
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _PyObject_DebugMallocStats(FILE *out);
+#endif /* #ifndef Py_LIMITED_API */
#ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */
PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes);
PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes);
PyAPI_FUNC(void) _PyObject_DebugFree(void *p);
PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p);
PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p);
-PyAPI_FUNC(void) _PyObject_DebugMallocStats(void);
PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes);
PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes);
PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p);
diff --git a/Include/setobject.h b/Include/setobject.h
index 00e5344..a14874b 100644
--- a/Include/setobject.h
+++ b/Include/setobject.h
@@ -101,6 +101,7 @@ PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable);
PyAPI_FUNC(int) PySet_ClearFreeList(void);
+PyAPI_FUNC(void) _PySet_DebugMallocStats(FILE *out);
#endif
#ifdef __cplusplus
diff --git a/Include/tupleobject.h b/Include/tupleobject.h
index f17b788..c273ce7 100644
--- a/Include/tupleobject.h
+++ b/Include/tupleobject.h
@@ -63,6 +63,9 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
#endif
PyAPI_FUNC(int) PyTuple_ClearFreeList(void);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(void) _PyTuple_DebugMallocStats(FILE *out);
+#endif /* Py_LIMITED_API */
#ifdef __cplusplus
}