[dovecot-cvs] dovecot/src/lib mempool-alloconly.c, 1.38, 1.39 mempool.h, 1.22, 1.23

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


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

Modified Files:
	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.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mempool-alloconly.c	8 Nov 2006 20:00:31 -0000	1.38
+++ mempool-alloconly.c	28 Dec 2006 23:21:06 -0000	1.39
@@ -23,6 +23,7 @@
 #ifdef DEBUG
 	const char *name;
 	size_t base_size;
+	bool disable_warning;
 #endif
 	bool clean_frees;
 };
@@ -110,6 +111,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. */
@@ -195,8 +200,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.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- mempool.h	8 Nov 2006 20:02:34 -0000	1.22
+++ mempool.h	28 Dec 2006 23:21:06 -0000	1.23
@@ -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