summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-09-03 20:25:30 (GMT)
committerGuido van Rossum <guido@python.org>1992-09-03 20:25:30 (GMT)
commit14b4adbd3365354f13b6a8a5f07a975a59ff1e34 (patch)
treec65e094bb37356d300f9693bf2dfa72cf943ac73 /Python/sysmodule.c
parente270b432f35e6eb987ed66fa565e74c1e521d895 (diff)
downloadcpython-14b4adbd3365354f13b6a8a5f07a975a59ff1e34.zip
cpython-14b4adbd3365354f13b6a8a5f07a975a59ff1e34.tar.gz
cpython-14b4adbd3365354f13b6a8a5f07a975a59ff1e34.tar.bz2
Add an optional interface to turn malloc debugging on and off.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 3a6516f..a83ec46 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -124,8 +124,29 @@ sys_setprofile(self, args)
return None;
}
+#ifdef USE_MALLOPT
+/* Link with -lmalloc (or -lmpc) on an SGI */
+#include <malloc.h>
+
+static object *
+sys_mdebug(self, args)
+ object *self;
+ object *args;
+{
+ int flag;
+ if (!getargs(args, "i", &flag))
+ return NULL;
+ mallopt(M_DEBUG, flag);
+ INCREF(None);
+ return None;
+}
+#endif /* USE_MALLOPT */
+
static struct methodlist sys_methods[] = {
{"exit", sys_exit},
+#ifdef USE_MALLOPT
+ {"mdebug", sys_mdebug},
+#endif
{"setprofile", sys_setprofile},
{"settrace", sys_settrace},
{NULL, NULL} /* sentinel */