]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add an optional interface to turn malloc debugging on and off.
authorGuido van Rossum <guido@python.org>
Thu, 3 Sep 1992 20:25:30 +0000 (20:25 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 3 Sep 1992 20:25:30 +0000 (20:25 +0000)
Python/sysmodule.c

index 3a6516ffa442df7b13d10d500f1031cc82a58cde..a83ec460e95b10cb9d9d1a34090571da0c5b9ceb 100644 (file)
@@ -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 */