aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/controller.c2
-rw-r--r--src/libserver/cfg_utils.c2
-rw-r--r--src/libserver/fuzzy_backend_sqlite.c3
-rw-r--r--src/libserver/milter.c2
-rw-r--r--src/libserver/rspamd_symcache.c2
-rw-r--r--src/libserver/task.c5
-rw-r--r--src/libutil/map_helpers.c10
-rw-r--r--src/libutil/mem_pool.c62
-rw-r--r--src/libutil/mem_pool.h42
-rw-r--r--src/libutil/mem_pool_internal.h5
-rw-r--r--src/libutil/radix.c2
-rw-r--r--src/libutil/upstream.c2
-rw-r--r--src/lua/lua_mempool.c2
-rw-r--r--src/lua/lua_regexp.c2
-rw-r--r--src/lua/lua_url.c2
-rw-r--r--src/lua/lua_util.c8
-rw-r--r--src/lua/lua_worker.c2
-rw-r--r--src/plugins/fuzzy_check.c3
-rw-r--r--src/rspamadm/rspamadm.c2
-rw-r--r--src/rspamd.c2
-rw-r--r--src/rspamd_proxy.c4
-rw-r--r--test/rspamd_dns_test.c4
-rw-r--r--test/rspamd_mem_pool_test.c6
-rw-r--r--test/rspamd_radix_test.c4
-rw-r--r--test/rspamd_test_suite.c4
25 files changed, 113 insertions, 71 deletions
diff --git a/src/controller.c b/src/controller.c
index 2ab796791..e4ad7085d 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -3088,7 +3088,7 @@ rspamd_controller_accept_socket (EV_P_ ev_io *w, int revents)
session = g_malloc0 (sizeof (struct rspamd_controller_session));
session->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "csession");
+ "csession", 0);
session->ctx = ctx;
session->cfg = ctx->cfg;
session->lang_det = ctx->lang_det;
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index ca5c71ea9..37a3d4578 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -133,7 +133,7 @@ rspamd_config_new (enum rspamd_config_init_flags flags)
struct rspamd_config *cfg;
rspamd_mempool_t *pool;
- pool = rspamd_mempool_new (8 * 1024 * 1024, "cfg");
+ pool = rspamd_mempool_new (8 * 1024 * 1024, "cfg", 0);
cfg = rspamd_mempool_alloc0 (pool, sizeof (*cfg));
/* Allocate larger pool for cfg */
cfg->cfg_pool = pool;
diff --git a/src/libserver/fuzzy_backend_sqlite.c b/src/libserver/fuzzy_backend_sqlite.c
index 90c0db70d..0f9b3c1ee 100644
--- a/src/libserver/fuzzy_backend_sqlite.c
+++ b/src/libserver/fuzzy_backend_sqlite.c
@@ -431,7 +431,8 @@ rspamd_fuzzy_backend_sqlite_open_db (const gchar *path, GError **err)
bk = g_malloc0 (sizeof (*bk));
bk->path = g_strdup (path);
bk->expired = 0;
- bk->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "fuzzy_backend");
+ bk->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
+ "fuzzy_backend", 0);
bk->db = rspamd_sqlite3_open_or_create (bk->pool, bk->path,
create_tables_sql, 1, err);
diff --git a/src/libserver/milter.c b/src/libserver/milter.c
index 1b24fa3da..bc33708ff 100644
--- a/src/libserver/milter.c
+++ b/src/libserver/milter.c
@@ -1105,7 +1105,7 @@ rspamd_milter_handle_socket (gint fd, ev_tstamp timeout,
priv->parser.buf = rspamd_fstring_sized_new (RSPAMD_MILTER_MESSAGE_CHUNK + 5);
priv->event_loop = ev_base;
priv->state = RSPAMD_MILTER_READ_MORE;
- priv->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "milter");
+ priv->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "milter", 0);
priv->discard_on_reject = milter_ctx->discard_on_reject;
priv->quarantine_on_reject = milter_ctx->quarantine_on_reject;
priv->ev.timeout = timeout;
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c
index d5022cedd..f232a6a24 100644
--- a/src/libserver/rspamd_symcache.c
+++ b/src/libserver/rspamd_symcache.c
@@ -1319,7 +1319,7 @@ rspamd_symcache_new (struct rspamd_config *cfg)
cache = g_malloc0 (sizeof (struct rspamd_symcache));
cache->static_pool =
- rspamd_mempool_new (rspamd_mempool_suggest_size (), "symcache");
+ rspamd_mempool_new (rspamd_mempool_suggest_size (), "symcache", 0);
cache->items_by_symbol = g_hash_table_new (rspamd_str_hash,
rspamd_str_equal);
cache->items_by_id = g_ptr_array_new ();
diff --git a/src/libserver/task.c b/src/libserver/task.c
index e7aab0f82..9eebe02a2 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -60,7 +60,8 @@ rspamd_task_quark (void)
* Create new task
*/
struct rspamd_task *
-rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
+rspamd_task_new (struct rspamd_worker *worker,
+ struct rspamd_config *cfg,
rspamd_mempool_t *pool,
struct rspamd_lang_detector *lang_det,
struct ev_loop *event_loop)
@@ -70,7 +71,7 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
guint flags = 0;
if (pool == NULL) {
- task_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "task");
+ task_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "task", 0);
flags |= RSPAMD_TASK_FLAG_OWN_POOL;
}
else {
diff --git a/src/libutil/map_helpers.c b/src/libutil/map_helpers.c
index d67e2fc4d..d179d44f5 100644
--- a/src/libutil/map_helpers.c
+++ b/src/libutil/map_helpers.c
@@ -631,11 +631,11 @@ rspamd_map_helper_new_hash (struct rspamd_map *map)
if (map) {
pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- map->tag);
+ map->tag, 0);
}
else {
pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- NULL);
+ NULL, 0);
}
htb = rspamd_mempool_alloc0 (pool, sizeof (*htb));
@@ -688,11 +688,11 @@ rspamd_map_helper_new_radix (struct rspamd_map *map)
if (map) {
pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- map->tag);
+ map->tag, 0);
}
else {
pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- NULL);
+ NULL, 0);
}
r = rspamd_mempool_alloc0 (pool, sizeof (*r));
@@ -746,7 +746,7 @@ rspamd_map_helper_new_regexp (struct rspamd_map *map,
rspamd_mempool_t *pool;
pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- map->tag);
+ map->tag, 0);
re_map = rspamd_mempool_alloc0 (pool, sizeof (*re_map));
re_map->pool = pool;
diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c
index 54113b265..728c10350 100644
--- a/src/libutil/mem_pool.c
+++ b/src/libutil/mem_pool.c
@@ -272,7 +272,7 @@ rspamd_mempool_append_chain (rspamd_mempool_t * pool,
* @return new memory pool object
*/
rspamd_mempool_t *
-rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
+rspamd_mempool_new_ (gsize size, const gchar *tag, gint flags, const gchar *loc)
{
rspamd_mempool_t *new_pool;
gpointer map;
@@ -345,6 +345,7 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
/*
* Memory layout:
* struct rspamd_mempool_t
+ * <optional debug hash table>
* struct rspamd_mempool_specific
* struct _pool_chain
* alignment (if needed)
@@ -353,6 +354,7 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
guchar *mem_chunk;
gint ret = posix_memalign ((void **)&mem_chunk, MIN_MEM_ALIGNMENT,
total_size);
+ gsize priv_offset;
if (ret != 0 || mem_chunk == NULL) {
g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes: %d - %s",
@@ -362,14 +364,26 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
/* Set memory layout */
new_pool = (rspamd_mempool_t *)mem_chunk;
+ if (flags & RSPAMD_MEMPOOL_DEBUG) {
+ /* Allocate debug table */
+ GHashTable *debug_tbl = (GHashTable *)(mem_chunk + sizeof (rspamd_mempool_t));
+
+ debug_tbl = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
+ priv_offset = sizeof (rspamd_mempool_t) + sizeof (GHashTable *);
+ }
+ else {
+ priv_offset = sizeof (rspamd_mempool_t);
+ }
+
new_pool->priv = (struct rspamd_mempool_specific *)(mem_chunk +
- sizeof (rspamd_mempool_t));
- /* Zere memory for specific and for the first chain */
+ priv_offset);
+ /* Zero memory for specific and for the first chain */
memset (new_pool->priv, 0, sizeof (struct rspamd_mempool_specific) +
sizeof (struct _pool_chain));
new_pool->priv->entry = entry;
new_pool->priv->elt_len = size;
+ new_pool->priv->flags = flags;
if (tag) {
rspamd_strlcpy (new_pool->tag.tagname, tag, sizeof (new_pool->tag.tagname));
@@ -393,11 +407,11 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
nchain = (struct _pool_chain *)
(mem_chunk +
- sizeof (rspamd_mempool_t) +
- sizeof (struct rspamd_mempool_specific));
+ priv_offset +
+ sizeof (struct rspamd_mempool_specific));
guchar *unaligned = mem_chunk +
- sizeof (rspamd_mempool_t) +
+ priv_offset +
sizeof (struct rspamd_mempool_specific) +
sizeof (struct _pool_chain);
@@ -418,12 +432,13 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc)
static void *
memory_pool_alloc_common (rspamd_mempool_t * pool, gsize size,
- enum rspamd_mempool_chain_type pool_type)
+ enum rspamd_mempool_chain_type pool_type,
+ const gchar *loc)
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
static void *
memory_pool_alloc_common (rspamd_mempool_t * pool, gsize size,
- enum rspamd_mempool_chain_type pool_type)
+ enum rspamd_mempool_chain_type pool_type, const gchar *loc)
{
guint8 *tmp;
struct _pool_chain *new, *cur;
@@ -497,22 +512,21 @@ memory_pool_alloc_common (rspamd_mempool_t * pool, gsize size,
void *
-rspamd_mempool_alloc (rspamd_mempool_t * pool, gsize size)
+rspamd_mempool_alloc_ (rspamd_mempool_t * pool, gsize size, const gchar *loc)
{
- return memory_pool_alloc_common (pool, size, RSPAMD_MEMPOOL_NORMAL);
+ return memory_pool_alloc_common (pool, size, RSPAMD_MEMPOOL_NORMAL, loc);
}
void *
-rspamd_mempool_alloc0 (rspamd_mempool_t * pool, gsize size)
+rspamd_mempool_alloc0_ (rspamd_mempool_t * pool, gsize size, const gchar *loc)
{
- void *pointer = rspamd_mempool_alloc (pool, size);
-
+ void *pointer = rspamd_mempool_alloc_ (pool, size, loc);
memset (pointer, 0, size);
return pointer;
}
void *
-rspamd_mempool_alloc0_shared (rspamd_mempool_t * pool, gsize size)
+rspamd_mempool_alloc0_shared_ (rspamd_mempool_t * pool, gsize size, const gchar *loc)
{
void *pointer = rspamd_mempool_alloc_shared (pool, size);
@@ -521,14 +535,14 @@ rspamd_mempool_alloc0_shared (rspamd_mempool_t * pool, gsize size)
}
void *
-rspamd_mempool_alloc_shared (rspamd_mempool_t * pool, gsize size)
+rspamd_mempool_alloc_shared_ (rspamd_mempool_t * pool, gsize size, const gchar *loc)
{
- return memory_pool_alloc_common (pool, size, RSPAMD_MEMPOOL_SHARED);
+ return memory_pool_alloc_common (pool, size, RSPAMD_MEMPOOL_SHARED, loc);
}
gchar *
-rspamd_mempool_strdup (rspamd_mempool_t * pool, const gchar *src)
+rspamd_mempool_strdup_ (rspamd_mempool_t * pool, const gchar *src, const gchar *loc)
{
gsize len;
gchar *newstr;
@@ -538,7 +552,7 @@ rspamd_mempool_strdup (rspamd_mempool_t * pool, const gchar *src)
}
len = strlen (src);
- newstr = rspamd_mempool_alloc (pool, len + 1);
+ newstr = rspamd_mempool_alloc_ (pool, len + 1, loc);
memcpy (newstr, src, len);
newstr[len] = '\0';
@@ -546,7 +560,8 @@ rspamd_mempool_strdup (rspamd_mempool_t * pool, const gchar *src)
}
gchar *
-rspamd_mempool_fstrdup (rspamd_mempool_t * pool, const struct f_str_s *src)
+rspamd_mempool_fstrdup_ (rspamd_mempool_t * pool, const struct f_str_s *src,
+ const gchar *loc)
{
gchar *newstr;
@@ -554,7 +569,7 @@ rspamd_mempool_fstrdup (rspamd_mempool_t * pool, const struct f_str_s *src)
return NULL;
}
- newstr = rspamd_mempool_alloc (pool, src->len + 1);
+ newstr = rspamd_mempool_alloc_ (pool, src->len + 1, loc);
memcpy (newstr, src->str, src->len);
newstr[src->len] = '\0';
@@ -562,7 +577,8 @@ rspamd_mempool_fstrdup (rspamd_mempool_t * pool, const struct f_str_s *src)
}
gchar *
-rspamd_mempool_ftokdup (rspamd_mempool_t *pool, const rspamd_ftok_t *src)
+rspamd_mempool_ftokdup_ (rspamd_mempool_t *pool, const rspamd_ftok_t *src,
+ const gchar *loc)
{
gchar *newstr;
@@ -570,7 +586,7 @@ rspamd_mempool_ftokdup (rspamd_mempool_t *pool, const rspamd_ftok_t *src)
return NULL;
}
- newstr = rspamd_mempool_alloc (pool, src->len + 1);
+ newstr = rspamd_mempool_alloc_ (pool, src->len + 1, loc);
memcpy (newstr, src->begin, src->len);
newstr[src->len] = '\0';
@@ -587,7 +603,7 @@ rspamd_mempool_add_destructor_full (rspamd_mempool_t * pool,
struct _pool_destructors *cur;
POOL_MTX_LOCK ();
- cur = rspamd_mempool_alloc (pool, sizeof (*cur));
+ cur = rspamd_mempool_alloc_ (pool, sizeof (*cur), line);
cur->func = func;
cur->data = data;
cur->function = function;
diff --git a/src/libutil/mem_pool.h b/src/libutil/mem_pool.h
index 75e949985..773be33d3 100644
--- a/src/libutil/mem_pool.h
+++ b/src/libutil/mem_pool.h
@@ -137,9 +137,11 @@ typedef struct memory_pool_stat_s {
* @param size size of pool's page
* @return new memory pool object
*/
-rspamd_mempool_t *rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc);
+rspamd_mempool_t *rspamd_mempool_new_ (gsize size, const gchar *tag, gint flags,
+ const gchar *loc);
-#define rspamd_mempool_new(size, tag) rspamd_mempool_new_((size), (tag), G_STRLOC)
+#define rspamd_mempool_new(size, tag, flags) \
+ rspamd_mempool_new_((size), (tag), (flags), G_STRLOC)
/**
* Get memory from pool
@@ -147,8 +149,10 @@ rspamd_mempool_t *rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar
* @param size bytes to allocate
* @return pointer to allocated object
*/
-void *rspamd_mempool_alloc (rspamd_mempool_t *pool, gsize size)
+void *rspamd_mempool_alloc_ (rspamd_mempool_t *pool, gsize size, const gchar *loc)
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
+#define rspamd_mempool_alloc(pool, size) \
+ rspamd_mempool_alloc_((pool), (size), G_STRLOC)
/**
* Get memory and set it to zero
@@ -156,8 +160,10 @@ RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR
* @param size bytes to allocate
* @return pointer to allocated object
*/
-void *rspamd_mempool_alloc0 (rspamd_mempool_t *pool, gsize size)
+void *rspamd_mempool_alloc0_ (rspamd_mempool_t *pool, gsize size, const gchar *loc)
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
+#define rspamd_mempool_alloc0(pool, size) \
+ rspamd_mempool_alloc0_((pool), (size), G_STRLOC)
/**
* Make a copy of string in pool
@@ -165,8 +171,10 @@ RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR
* @param src source string
* @return pointer to newly created string that is copy of src
*/
-gchar *rspamd_mempool_strdup (rspamd_mempool_t *pool, const gchar *src)
+gchar *rspamd_mempool_strdup_ (rspamd_mempool_t *pool, const gchar *src, const gchar *loc)
RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT);
+#define rspamd_mempool_strdup(pool, src) \
+ rspamd_mempool_strdup_ ((pool), (src), G_STRLOC)
/**
* Make a copy of fixed string in pool as null terminated string
@@ -174,8 +182,12 @@ RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT);
* @param src source string
* @return pointer to newly created string that is copy of src
*/
-gchar *rspamd_mempool_fstrdup (rspamd_mempool_t *pool,
- const struct f_str_s *src) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT);
+gchar *rspamd_mempool_fstrdup_ (rspamd_mempool_t *pool,
+ const struct f_str_s *src,
+ const gchar *loc)
+RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT);
+#define rspamd_mempool_fstrdup(pool, src) \
+ rspamd_mempool_fstrdup_ ((pool), (src), G_STRLOC)
struct f_str_tok;
@@ -185,19 +197,27 @@ struct f_str_tok;
* @param src source string
* @return pointer to newly created string that is copy of src
*/
-gchar *rspamd_mempool_ftokdup (rspamd_mempool_t *pool,
- const struct f_str_tok *src) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT);
+gchar *rspamd_mempool_ftokdup_ (rspamd_mempool_t *pool,
+ const struct f_str_tok *src,
+ const gchar *loc)
+RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT);
+#define rspamd_mempool_ftokdup(pool, src) \
+ rspamd_mempool_ftokdup_ ((pool), (src), G_STRLOC)
/**
* Allocate piece of shared memory
* @param pool memory pool object
* @param size bytes to allocate
*/
-void *rspamd_mempool_alloc_shared (rspamd_mempool_t *pool, gsize size)
+void *rspamd_mempool_alloc_shared_ (rspamd_mempool_t *pool, gsize size, const gchar *loc)
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
+#define rspamd_mempool_alloc_shared(pool, size) \
+ rspamd_mempool_alloc_shared_((pool), (size), G_STRLOC)
-void *rspamd_mempool_alloc0_shared (rspamd_mempool_t *pool, gsize size)
+void *rspamd_mempool_alloc0_shared_ (rspamd_mempool_t *pool, gsize size, const gchar *loc)
RSPAMD_ATTR_ALLOC_SIZE(2) RSPAMD_ATTR_ALLOC_ALIGN(MIN_MEM_ALIGNMENT) RSPAMD_ATTR_RETURNS_NONNUL;
+#define rspamd_mempool_alloc0_shared(pool, size) \
+ rspamd_mempool_alloc0_shared_((pool), (size), G_STRLOC)
/**
* Add destructor callback to pool
diff --git a/src/libutil/mem_pool_internal.h b/src/libutil/mem_pool_internal.h
index c96287a68..1f253e790 100644
--- a/src/libutil/mem_pool_internal.h
+++ b/src/libutil/mem_pool_internal.h
@@ -60,10 +60,11 @@ struct rspamd_mempool_specific {
struct _pool_destructors *dtors_head, *dtors_tail;
GPtrArray *trash_stack;
GHashTable *variables; /**< private memory pool variables */
+ struct rspamd_mempool_entry_point *entry;
gsize elt_len; /**< size of an element */
gsize used_memory;
- gsize wasted_memory;
- struct rspamd_mempool_entry_point *entry;
+ guint wasted_memory;
+ gint flags;
};
/**
diff --git a/src/libutil/radix.c b/src/libutil/radix.c
index 3ea6c6b8c..8eb05cd1f 100644
--- a/src/libutil/radix.c
+++ b/src/libutil/radix.c
@@ -130,7 +130,7 @@ radix_create_compressed (void)
return NULL;
}
- tree->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ tree->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
tree->size = 0;
tree->duplicates = 0;
tree->tree = btrie_init (tree->pool);
diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c
index 7d8b81048..196d9cde8 100644
--- a/src/libutil/upstream.c
+++ b/src/libutil/upstream.c
@@ -258,7 +258,7 @@ rspamd_upstreams_library_init (void)
ctx = g_malloc0 (sizeof (*ctx));
memcpy (&ctx->limits, &default_limits, sizeof (ctx->limits));
ctx->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "upstreams");
+ "upstreams", 0);
ctx->upstreams = g_queue_new ();
REF_INIT_RETAIN (ctx, rspamd_upstream_ctx_dtor);
diff --git a/src/lua/lua_mempool.c b/src/lua/lua_mempool.c
index 06dcd2d5c..c376ee701 100644
--- a/src/lua/lua_mempool.c
+++ b/src/lua/lua_mempool.c
@@ -154,7 +154,7 @@ lua_mempool_create (lua_State *L)
{
LUA_TRACE_POINT;
struct memory_pool_s *mempool = rspamd_mempool_new (
- rspamd_mempool_suggest_size (), "lua"), **pmempool;
+ rspamd_mempool_suggest_size (), "lua", 0), **pmempool;
if (mempool) {
pmempool = lua_newuserdata (L, sizeof (struct memory_pool_s *));
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index c0458a876..70a5a5df4 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -891,7 +891,7 @@ luaopen_regexp (lua_State * L)
{
if (!regexp_static_pool) {
regexp_static_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "regexp_lua_pool");
+ "regexp_lua_pool", 0);
}
rspamd_lua_new_class (L, "rspamd{regexp}", regexplib_m);
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index c0cfb49b8..0bd4f1c7e 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -731,7 +731,7 @@ lua_url_create (lua_State *L)
}
else {
own_pool = TRUE;
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "url");
+ pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "url", 0);
text = luaL_checklstring (L, 1, &length);
}
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index ef9c3105e..b71339402 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -1386,7 +1386,7 @@ lua_util_parse_html (lua_State *L)
}
if (start != NULL) {
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
hc = rspamd_mempool_alloc0 (pool, sizeof (*hc));
in = g_byte_array_sized_new (len);
g_byte_array_append (in, start, len);
@@ -1456,7 +1456,8 @@ lua_util_parse_addr (lua_State *L)
}
}
else {
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "lua util");
+ pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
+ "lua util", 0);
own_pool = TRUE;
}
@@ -1660,7 +1661,8 @@ lua_util_parse_mail_address (lua_State *L)
}
}
else {
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "lua util");
+ pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
+ "lua util", 0);
own_pool = TRUE;
}
diff --git a/src/lua/lua_worker.c b/src/lua/lua_worker.c
index 4a3e4e908..17266ae96 100644
--- a/src/lua/lua_worker.c
+++ b/src/lua/lua_worker.c
@@ -423,7 +423,7 @@ lua_worker_add_control_handler (lua_State *L)
}
rspamd_mempool_t *pool = rspamd_mempool_new (
- rspamd_mempool_suggest_size (), "lua_control");
+ rspamd_mempool_suggest_size (), "lua_control", 0);
cbd = rspamd_mempool_alloc0 (pool, sizeof (*cbd));
cbd->pool = pool;
cbd->event_loop = event_loop;
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 9874c8bbc..713edc41b 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -618,7 +618,8 @@ fuzzy_check_module_init (struct rspamd_config *cfg, struct module_ctx **ctx)
fuzzy_module_ctx = rspamd_mempool_alloc0 (cfg->cfg_pool,
sizeof (struct fuzzy_ctx));
- fuzzy_module_ctx->fuzzy_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ fuzzy_module_ctx->fuzzy_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
+ NULL, 0);
/* TODO: this should match rules count actually */
fuzzy_module_ctx->keypairs_cache = rspamd_keypair_cache_new (32);
fuzzy_module_ctx->fuzzy_rules = g_ptr_array_new ();
diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c
index 661b468af..775b505ee 100644
--- a/src/rspamadm/rspamadm.c
+++ b/src/rspamadm/rspamadm.c
@@ -396,7 +396,7 @@ main (gint argc, gchar **argv, gchar **env)
rspamd_main->pid = getpid ();
rspamd_main->type = process_quark;
rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "rspamadm");
+ "rspamadm", 0);
rspamadm_fill_internal_commands (all_commands);
help_command.command_data = all_commands;
diff --git a/src/rspamd.c b/src/rspamd.c
index b7c3bd910..f25884f6f 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -1186,7 +1186,7 @@ main (gint argc, gchar **argv, gchar **env)
rspamd_main = (struct rspamd_main *) g_malloc0 (sizeof (struct rspamd_main));
rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "main");
+ "main", 0);
rspamd_main->stat = rspamd_mempool_alloc0_shared (rspamd_main->server_pool,
sizeof (struct rspamd_stat));
rspamd_main->cfg = rspamd_config_new (RSPAMD_CONFIG_INIT_DEFAULT);
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index 2a0cadbf1..6153ddd21 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -1172,7 +1172,7 @@ proxy_session_refresh (struct rspamd_proxy_session *session)
session->client_addr = NULL;
nsession->ctx = session->ctx;
nsession->worker = session->worker;
- nsession->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "proxy");
+ nsession->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "proxy", 0);
nsession->client_sock = session->client_sock;
session->client_sock = -1;
nsession->mirror_conns = g_ptr_array_sized_new (nsession->ctx->mirrors->len);
@@ -2169,7 +2169,7 @@ proxy_accept_socket (EV_P_ ev_io *w, int revents)
session->mirror_conns = g_ptr_array_sized_new (ctx->mirrors->len);
session->pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
- "proxy");
+ "proxy", 0);
session->ctx = ctx;
session->worker = worker;
diff --git a/test/rspamd_dns_test.c b/test/rspamd_dns_test.c
index 6b12746ae..25c28528e 100644
--- a/test/rspamd_dns_test.c
+++ b/test/rspamd_dns_test.c
@@ -70,11 +70,11 @@ rspamd_dns_test_func ()
cfg = (struct rspamd_config *)g_malloc (sizeof (struct rspamd_config));
bzero (cfg, sizeof (struct rspamd_config));
- cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
cfg->dns_retransmits = 2;
cfg->dns_timeout = 0.5;
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
s = rspamd_session_create (pool, session_fin, NULL, NULL, NULL);
diff --git a/test/rspamd_mem_pool_test.c b/test/rspamd_mem_pool_test.c
index 61b9a7a94..61b4efe3f 100644
--- a/test/rspamd_mem_pool_test.c
+++ b/test/rspamd_mem_pool_test.c
@@ -20,7 +20,7 @@ rspamd_mem_pool_test_func ()
pid_t pid;
int ret;
- pool = rspamd_mempool_new (sizeof (TEST_BUF), NULL);
+ pool = rspamd_mempool_new (sizeof (TEST_BUF), NULL, 0);
tmp = rspamd_mempool_alloc (pool, sizeof (TEST_BUF));
tmp2 = rspamd_mempool_alloc (pool, sizeof (TEST_BUF) * 2);
tmp3 = rspamd_mempool_alloc_shared (pool, sizeof (TEST_BUF));
@@ -32,8 +32,8 @@ rspamd_mem_pool_test_func ()
g_assert (strncmp (tmp, TEST_BUF, sizeof (TEST_BUF)) == 0);
g_assert (strncmp (tmp2, TEST2_BUF, sizeof (TEST2_BUF)) == 0);
g_assert (strncmp (tmp3, TEST_BUF, sizeof (TEST_BUF)) == 0);
-
+
rspamd_mempool_delete (pool);
rspamd_mempool_stat (&st);
-
+
}
diff --git a/test/rspamd_radix_test.c b/test/rspamd_radix_test.c
index 5a42b36e5..dda0bff36 100644
--- a/test/rspamd_radix_test.c
+++ b/test/rspamd_radix_test.c
@@ -148,7 +148,7 @@ rspamd_btrie_test_vec (void)
gsize i;
gpointer val;
- pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "btrie");
+ pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "btrie", 0);
tree = btrie_init (pool);
while (t->ip != NULL) {
@@ -238,7 +238,7 @@ rspamd_radix_test_func (void)
addrs[i].mask6 = ottery_rand_range(128);
}
- pool = rspamd_mempool_new (65536, "btrie");
+ pool = rspamd_mempool_new (65536, "btrie", 0);
btrie = btrie_init (pool);
msg_notice ("btrie performance (%z elts)", nelts);
diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c
index db12a1a0c..d7b660642 100644
--- a/test/rspamd_test_suite.c
+++ b/test/rspamd_test_suite.c
@@ -31,11 +31,11 @@ main (int argc, char **argv)
rspamd_main = (struct rspamd_main *)g_malloc (sizeof (struct rspamd_main));
memset (rspamd_main, 0, sizeof (struct rspamd_main));
- rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
cfg = rspamd_config_new (RSPAMD_CONFIG_INIT_DEFAULT);
cfg->libs_ctx = rspamd_init_libs ();
rspamd_main->cfg = cfg;
- cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL);
+ cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL, 0);
cfg->log_type = RSPAMD_LOG_CONSOLE;
cfg->log_level = G_LOG_LEVEL_MESSAGE;