Explicitly test for malloc_trim() in configure

This commit is contained in:
Jean-Francois Dockes 2020-02-25 16:45:29 +01:00
parent 38dfa5f841
commit 25a5f3a7e0
3 changed files with 6 additions and 3 deletions

View File

@ -45,6 +45,9 @@
/* Define to 1 if you have the `z' library (-lz). */ /* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ #undef HAVE_LIBZ
/* Define to 1 if you have the `malloc_trim' function. */
#undef HAVE_MALLOC_TRIM
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H

View File

@ -37,7 +37,7 @@ AC_SYS_LARGEFILE
# OpenBSD needs sys/param.h for mount.h to compile # OpenBSD needs sys/param.h for mount.h to compile
AC_CHECK_HEADERS([sys/param.h, spawn.h]) AC_CHECK_HEADERS([sys/param.h, spawn.h])
AC_CHECK_FUNCS([posix_spawn setrlimit kqueue vsnprintf]) AC_CHECK_FUNCS([posix_spawn setrlimit kqueue vsnprintf malloc_trim])
if test "x$ac_cv_func_posix_spawn" = xyes; then : if test "x$ac_cv_func_posix_spawn" = xyes; then :
AC_ARG_ENABLE(posix_spawn, AC_ARG_ENABLE(posix_spawn,

View File

@ -52,9 +52,9 @@ public:
// malloc_trim() and mallopt() doc seems to be a bit // malloc_trim() and mallopt() doc seems to be a bit
// misleading, there is probably a frag size under which // misleading, there is probably a frag size under which
// free() does not try to malloc_trim() at all // free() does not try to malloc_trim() at all
#ifndef _WIN32 #ifdef HAVE_MALLOC_TRIM
malloc_trim(0); malloc_trim(0);
#endif #endif /* HAVE_MALLOC_TRIM */
} }
} }