diff Python/sysmodule.c @ 1013:a1ce5a949828 legacy-trunk

Add an optional interface to turn malloc debugging on and off.
author Guido van Rossum <guido@python.org>
date Thu, 03 Sep 1992 20:25:30 +0000
parents fea3f594df77
children 2c0432fcc270
line wrap: on
line diff
--- a/Python/sysmodule.c	Thu Sep 03 20:21:07 1992 +0000
+++ b/Python/sysmodule.c	Thu Sep 03 20:25:30 1992 +0000
@@ -124,8 +124,29 @@
 	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 */