check if malloc_trim() is available

This commit is contained in:
Wim Taymans 2023-10-04 10:59:26 +02:00
parent 7e2f6757fc
commit 8680c74d1b
2 changed files with 4 additions and 2 deletions

View file

@ -435,6 +435,7 @@ check_functions = [
['reallocarray', '#include <stdlib.h>', ['-D_GNU_SOURCE'], []],
['sigabbrev_np', '#include <string.h>', ['-D_GNU_SOURCE'], []],
['XSetIOErrorExitHandler', '#include <X11/Xlib.h>', [], [x11_dep]],
['malloc_trim', '#include <malloc.h>', [], []],
]
foreach f : check_functions

View file

@ -2030,7 +2030,6 @@ void pw_impl_node_destroy(struct pw_impl_node *node)
struct pw_impl_node *follower;
struct pw_context *context = node->context;
bool active, had_driver;
int res;
active = node->active;
node->active = false;
@ -2106,8 +2105,10 @@ void pw_impl_node_destroy(struct pw_impl_node *node)
spa_system_close(node->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