From 8680c74d1bd83b4969c9305171076b36f56d82fa Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 4 Oct 2023 10:59:26 +0200 Subject: [PATCH] check if malloc_trim() is available --- meson.build | 1 + src/pipewire/impl-node.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) --- a/meson.build +++ b/meson.build @@ -401,6 +401,7 @@ ['reallocarray', '#include ', ['-D_GNU_SOURCE'], []], ['sigabbrev_np', '#include ', ['-D_GNU_SOURCE'], []], ['XSetIOErrorExitHandler', '#include ', [], [x11_dep]], + ['malloc_trim', '#include ', [], []], ] foreach f : check_functions --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -1874,7 +1874,6 @@ struct pw_impl_node *follower; struct pw_context *context = node->context; bool active, had_driver; - int res; active = node->active; node->active = false; @@ -1948,8 +1947,10 @@ spa_system_close(context->data_system, node->source.fd); free(impl); - res = malloc_trim(0); +#ifdef HAVE_MALLOC_TRIM + int res = malloc_trim(0); pw_log_debug("malloc_trim(): %d", res); +#endif } SPA_EXPORT