diff --git a/meson.build b/meson.build index 2bf6b3bfa..b445ca2d7 100644 --- a/meson.build +++ b/meson.build @@ -436,6 +436,7 @@ check_functions = [ ['sigabbrev_np', '#include ', ['-D_GNU_SOURCE'], []], ['XSetIOErrorExitHandler', '#include ', [], [x11_dep]], ['malloc_trim', '#include ', [], []], + ['malloc_info', '#include ', [], []], ] foreach f : check_functions diff --git a/src/modules/module-protocol-pulse/message-handler.c b/src/modules/module-protocol-pulse/message-handler.c index aed1307b8..a4a003fd9 100644 --- a/src/modules/module-protocol-pulse/message-handler.c +++ b/src/modules/module-protocol-pulse/message-handler.c @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -104,6 +105,15 @@ static int core_object_message_handler(struct client *client, struct pw_manager_ } } fputc(']', response); +#ifdef HAVE_MALLOC_INFO + } else if (spa_streq(message, "malloc-info")) { + malloc_info(0, response); +#endif +#ifdef HAVE_MALLOC_TRIM + } else if (spa_streq(message, "malloc-trim")) { + int res = malloc_trim(0); + fprintf(response, "%d", res); +#endif } else { return -ENOSYS; }