comparison Python/sysmodule.c @ 77577:d63a80abfbec

Issue #14785: Add sys._debugmallocstats() to help debug low-level memory allocation issues
author David Malcolm <dmalcolm@redhat.com>
date Fri, 22 Jun 2012 14:55:41 -0400
parents 9c445f4695c1
children ee01fd98b5b0
comparison
equal deleted inserted replaced
77576:dfc7fd24983a 77577:d63a80abfbec
994 ); 994 );
995 995
996 #ifdef __cplusplus 996 #ifdef __cplusplus
997 extern "C" { 997 extern "C" {
998 #endif 998 #endif
999
1000 static PyObject *
1001 sys_debugmallocstats(PyObject *self, PyObject *args)
1002 {
1003 #ifdef WITH_PYMALLOC
1004 _PyObject_DebugMallocStats(stderr);
1005 fputc('\n', stderr);
1006 #endif
1007 _PyObject_DebugTypeStats(stderr);
1008
1009 Py_RETURN_NONE;
1010 }
1011 PyDoc_STRVAR(debugmallocstats_doc,
1012 "_debugmallocstats()\n\
1013 \n\
1014 Print summary info to stderr about the state of\n\
1015 pymalloc's structures.\n\
1016 \n\
1017 In Py_DEBUG mode, also perform some expensive internal consistency\n\
1018 checks.\n\
1019 ");
999 1020
1000 #ifdef Py_TRACE_REFS 1021 #ifdef Py_TRACE_REFS
1001 /* Defined in objects.c because it uses static globals if that file */ 1022 /* Defined in objects.c because it uses static globals if that file */
1002 extern PyObject *_Py_GetObjects(PyObject *, PyObject *); 1023 extern PyObject *_Py_GetObjects(PyObject *, PyObject *);
1003 #endif 1024 #endif
1091 {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc}, 1112 {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc},
1092 #endif 1113 #endif
1093 {"settrace", sys_settrace, METH_O, settrace_doc}, 1114 {"settrace", sys_settrace, METH_O, settrace_doc},
1094 {"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc}, 1115 {"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc},
1095 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, 1116 {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc},
1117 {"_debugmallocstats", sys_debugmallocstats, METH_VARARGS,
1118 debugmallocstats_doc},
1096 {NULL, NULL} /* sentinel */ 1119 {NULL, NULL} /* sentinel */
1097 }; 1120 };
1098 1121
1099 static PyObject * 1122 static PyObject *
1100 list_builtin_module_names(void) 1123 list_builtin_module_names(void)