pulse-server: add /core message handlers for memory debugging

Add malloc-info and malloc-trim message handlers.
This commit is contained in:
Wim Taymans 2023-10-06 16:49:03 +02:00
parent e8f17814ba
commit 4b27807292
2 changed files with 11 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include <stdio.h>
#include <regex.h>
#include <malloc.h>
#include <spa/param/props.h>
#include <spa/pod/builder.h>
@ -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;
}