[dovecot-cvs] dovecot/src/lib mempool-alloconly.c, 1.35.2.3, 1.35.2.4 mempool.h, 1.18, 1.18.2.1

tss at dovecot.org tss at dovecot.org
Thu Dec 28 23:21:06 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv11753/lib

Modified Files:
      Tag: branch_1_0
	mempool-alloconly.c mempool.h 
Log Message:
debug: MEMPOOL_GROWING prefix in alloconly pool names means that when
the memory pool needs to be grown, there's no need to log a warning.



Index: mempool-alloconly.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool-alloconly.c,v
retrieving revision 1.35.2.3
retrieving revision 1.35.2.4
diff -u -d -r1.35.2.3 -r1.35.2.4
--- mempool-alloconly.c	10 Sep 2006 17:49:06 -0000	1.35.2.3
+++ mempool-alloconly.c	28 Dec 2006 23:21:03 -0000	1.35.2.4
@@ -22,6 +22,7 @@
 #ifdef DEBUG
 	const char *name;
 	size_t base_size;
+	bool disable_warning;
 #endif
 };
 
@@ -108,6 +109,10 @@
 	new_apool = p_new(&apool.pool, struct alloconly_pool, 1);
 	*new_apool = apool;
 #ifdef DEBUG
+	if (strncmp(name, MEMPOOL_GROWING, strlen(MEMPOOL_GROWING)) == 0) {
+		name += strlen(MEMPOOL_GROWING);
+		new_apool->disable_warning = TRUE;
+	}
 	new_apool->name = p_strdup(&new_apool->pool, name);
 
 	/* set base_size so p_clear() doesn't trash alloconly_pool structure. */
@@ -179,8 +184,10 @@
 
 		size = nearest_power(size);
 #ifdef DEBUG
-		i_warning("Growing pool '%s' with: %"PRIuSIZE_T,
-			  apool->name, size);
+		if (!apool->disable_warning) {
+			i_warning("Growing pool '%s' with: %"PRIuSIZE_T,
+				  apool->name, size);
+		}
 #endif
 	}
 

Index: mempool.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/mempool.h,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -d -r1.18 -r1.18.2.1
--- mempool.h	14 Jan 2006 17:23:22 -0000	1.18
+++ mempool.h	28 Dec 2006 23:21:03 -0000	1.18.2.1
@@ -3,6 +3,13 @@
 
 #include "macros.h"
 
+/* When DEBUG is enabled, Dovecot warns whenever a memory pool is grown.
+   This is done so that the initial pool size could be set large enough so that
+   it wouldn't grow in normal use. For some memory pools it's too difficult
+   to calculate a good initial size, so this prefix should be used with those
+   pools to disable the warning. */
+#define MEMPOOL_GROWING "GROWING-"
+
 /* Memory allocated and reallocated (the new data in it) in pools is always
    zeroed, it will cost only a few CPU cycles and may well save some debug
    time. */



More information about the dovecot-cvs mailing list