From: Timo Sirainen Date: Sun, 4 May 2008 16:39:04 +0000 (+0300) Subject: Memory pool allocation tweaks. X-Git-Tag: 1.1.rc5~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=221351ed85c839e0b03d82c47654c3d17202e3db;p=thirdparty%2Fdovecot%2Fcore.git Memory pool allocation tweaks. --HG-- branch : HEAD --- diff --git a/src/auth/auth-stream.c b/src/auth/auth-stream.c index 0611888b78..93bb9f745f 100644 --- a/src/auth/auth-stream.c +++ b/src/auth/auth-stream.c @@ -15,7 +15,7 @@ struct auth_stream_reply *auth_stream_reply_init(pool_t pool) struct auth_stream_reply *reply; reply = p_new(pool, struct auth_stream_reply, 1); - reply->str = str_new(pool, 256); + reply->str = str_new(pool, 128); return reply; } diff --git a/src/auth/db-passwd-file.c b/src/auth/db-passwd-file.c index f97f4ff2e7..ccf8a2543a 100644 --- a/src/auth/db-passwd-file.c +++ b/src/auth/db-passwd-file.c @@ -178,7 +178,7 @@ static bool passwd_file_open(struct passwd_file *pw) pw->stamp = st.st_mtime; pw->size = st.st_size; - pw->pool = pool_alloconly_create("passwd_file", 10240);; + pw->pool = pool_alloconly_create(MEMPOOL_GROWING"passwd_file", 10240); pw->users = hash_create(default_pool, pw->pool, 100, str_hash, (hash_cmp_callback_t *)strcmp); diff --git a/src/lib-index/mail-index-map.c b/src/lib-index/mail-index-map.c index 6413461d95..bdb74d206b 100644 --- a/src/lib-index/mail-index-map.c +++ b/src/lib-index/mail-index-map.c @@ -25,7 +25,7 @@ static void mail_index_map_init_extbufs(struct mail_index_map *map, size = EXT_GLOBAL_ALLOC_SIZE + initial_count * EXT_PER_ALLOC_SIZE; map->extension_pool = - pool_alloconly_create("map extensions", + pool_alloconly_create(MEMPOOL_GROWING"map extensions", nearest_power(size)); } else { p_clear(map->extension_pool); diff --git a/src/lib-mail/istream-header-filter.c b/src/lib-mail/istream-header-filter.c index e3f085bb5f..175ba546ba 100644 --- a/src/lib-mail/istream-header-filter.c +++ b/src/lib-mail/istream-header-filter.c @@ -398,7 +398,8 @@ i_stream_create_header_filter(struct istream *input, i_assert((flags & (HEADER_FILTER_INCLUDE|HEADER_FILTER_EXCLUDE)) != 0); mstream = i_new(struct header_filter_istream, 1); - mstream->pool = pool_alloconly_create("header filter stream", 4096); + mstream->pool = pool_alloconly_create(MEMPOOL_GROWING + "header filter stream", 4096); mstream->istream.max_buffer_size = input->real_stream->max_buffer_size; mstream->headers = headers_count == 0 ? NULL : diff --git a/src/lib/env-util.c b/src/lib/env-util.c index fb1d7989f4..708709b216 100644 --- a/src/lib/env-util.c +++ b/src/lib/env-util.c @@ -9,9 +9,10 @@ static pool_t pool = NULL; void env_put(const char *env) { - if (pool == NULL) - pool = pool_alloconly_create("Environment", 2048); - + if (pool == NULL) { + pool = pool_alloconly_create(MEMPOOL_GROWING"Environment", + 2048); + } if (putenv(p_strdup(pool, env)) != 0) i_fatal("putenv(%s) failed: %m", env); }