The hot reload results in large chunks of memory being freed as the
as the old signature tables are discarded. Help the memory management
system along by telling to release as much memory as it can at this
point.
Bug: #6454.
#include <sys/random.h>
])
+ AC_CHECK_HEADERS([malloc.h])
+ AC_CHECK_DECL([malloc_trim],
+ AC_DEFINE([HAVE_MALLOC_TRIM], [1], [Use malloc_trim]),
+ [], [
+ #include <malloc.h>
+ ])
+
OCFLAGS=$CFLAGS
CFLAGS=""
AC_CHECK_FUNCS([strlcpy strlcat])
SCLogDebug("old_de_ctx should have been freed");
SCLogNotice("rule reload complete");
+
+#ifdef HAVE_MALLOC_TRIM
+ /* The reload process potentially frees up large amounts of memory.
+ * Encourage the memory management system to reclaim as much as it
+ * can.
+ */
+ malloc_trim(0);
+#endif
+
return 0;
}
#include <netdb.h>
#endif
+#if HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+
#if __CYGWIN__
#if !defined _X86_ && !defined __x86_64
#define _X86_