From: Vsevolod Stakhov Date: Sat, 27 Jan 2018 15:22:01 +0000 (+0000) Subject: [Minor] Allocate larger config static pool X-Git-Tag: 1.7.0~243 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ec72b3f03d16e6ca84a9035b308048fe5abe3cda;p=thirdparty%2Frspamd.git [Minor] Allocate larger config static pool --- diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index e14495ded4..d3e27755e2 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -117,7 +117,8 @@ rspamd_config_new (void) struct rspamd_config *cfg; cfg = g_malloc0 (sizeof (*cfg)); - cfg->cfg_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), "cfg"); + /* Allocate larger pool for cfg */ + cfg->cfg_pool = rspamd_mempool_new (8 * 1024 * 1024, "cfg"); cfg->dns_timeout = 1000; cfg->dns_retransmits = 5; /* After 20 errors do throttling for 10 seconds */ diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c index f45bf88579..4b48756998 100644 --- a/src/libutil/mem_pool.c +++ b/src/libutil/mem_pool.c @@ -354,7 +354,13 @@ rspamd_mempool_new_ (gsize size, const gchar *tag, const gchar *loc) sizeof (struct _pool_destructors), 32); rspamd_mempool_create_pool_type (new, RSPAMD_MEMPOOL_NORMAL); /* Set it upon first call of set variable */ - new->elt_len = new->entry->cur_suggestion; + + if (size == 0) { + new->elt_len = new->entry->cur_suggestion; + } + else { + new->elt_len = size; + } if (tag) { rspamd_strlcpy (new->tag.tagname, tag, sizeof (new->tag.tagname));