From 621bb79b7044dcc277386eb7338c0eb1e08c29c7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 10 Nov 2020 19:41:04 +0200 Subject: [PATCH] New debugging command 'malloc-info' * src/alloc.c (Fmalloc_info) [GNU_LINUX]: New command. (syms_of_alloc): Defsubr it. (Bug#43389) --- src/alloc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/alloc.c b/src/alloc.c index f90d09265d0..2b3643e35bd 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -7194,6 +7194,20 @@ Frames, windows, buffers, and subprocesses count as vectors make_int (strings_consed)); } +#ifdef GNU_LINUX +DEFUN ("malloc-info", Fmalloc_info, Smalloc_info, 0, 0, "", + doc: /* Report malloc information to stderr. +This function outputs to stderr an XML-formatted +description of the current state of the memory-allocation +arenas. */) + (void) +{ + if (malloc_info (0, stderr)) + error ("malloc_info failed: %s", emacs_strerror (errno)); + return Qnil; +} +#endif + static bool symbol_uses_obj (Lisp_Object symbol, Lisp_Object obj) { @@ -7538,6 +7552,9 @@ N should be nonnegative. */); defsubr (&Sgarbage_collect); defsubr (&Smemory_info); defsubr (&Smemory_use_counts); +#ifdef GNU_LINUX + defsubr (&Smalloc_info); +#endif defsubr (&Ssuspicious_object); Lisp_Object watcher; -- 2.39.2