aboutsummaryrefslogtreecommitdiffstats
path: root/config.h.in
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-11 11:23:47 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-11 11:23:47 +0100
commitf36e38a2a4d3e3a877ac02adc14ba42389a971e9 (patch)
tree2cbddadf13c448233fcd0d32b81444c8189c631b /config.h.in
parentef0566a96a0532da690107c80ea2d36d4db82f2a (diff)
downloadrspamd-f36e38a2a4d3e3a877ac02adc14ba42389a971e9.tar.gz
rspamd-f36e38a2a4d3e3a877ac02adc14ba42389a971e9.zip
[Feature] Allow building rspamd with jemalloc
Diffstat (limited to 'config.h.in')
-rw-r--r--config.h.in13
1 files changed, 13 insertions, 0 deletions
diff --git a/config.h.in b/config.h.in
index 50a17c0a5..2b553efe3 100644
--- a/config.h.in
+++ b/config.h.in
@@ -122,6 +122,7 @@
#cmakedefine WITH_GPERF_TOOLS 1
#cmakedefine WITH_HIREDIS 1
#cmakedefine WITH_HYPERSCAN 1
+#cmakedefine WITH_JEMALLOC 1
#cmakedefine WITH_JUDY 1
#cmakedefine WITH_LUA 1
#cmakedefine WITH_PCRE2 1
@@ -244,6 +245,10 @@
#include <stdlib.h>
#endif
+#ifdef WITH_JEMALLOC
+#include <jemalloc.h>
+#endif
+
/* stdio */
#ifdef HAVE_STDIO_H
#include <stdio.h>
@@ -330,4 +335,12 @@ typedef off_t goffset;
extern uint64_t ottery_rand_uint64(void);
#define UCL_RANDOM_FUNCTION ottery_rand_uint64()
+/* Disable slab allocator if jemalloc is already in the system */
+#if defined(WITH_JEMALLOC) || defined(__FreeBSD__) || \
+ (defined(__NetBSD__) && __NetBSD_Version__ >= 500000000)
+ #define g_slice_alloc(sz) g_malloc(sz)
+ #define g_slice_alloc0(sz) g_malloc0(sz)
+ #define g_slice_free1(sz, p) g_free(p)
+#endif
+
#endif