changeset 10217:a553595ce5a9 HEAD

dsync: Memory usage tweaks.
author Timo Sirainen <tss@iki.fi>
date Wed, 28 Oct 2009 16:12:06 -0400
parents e3d0385ce703
children eb9a262fde74
files src/dsync/dsync-brain.c src/dsync/dsync-proxy-client.c
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/dsync/dsync-brain.c	Wed Oct 28 16:01:06 2009 -0400
+++ b/src/dsync/dsync-brain.c	Wed Oct 28 16:12:06 2009 -0400
@@ -333,12 +333,15 @@
 static void dsync_brain_sync_msgs(struct dsync_brain *brain)
 {
 	ARRAY_TYPE(dsync_brain_mailbox) mailboxes;
+	pool_t pool;
 
-	t_array_init(&mailboxes, 128);
+	pool = pool_alloconly_create("dsync changed mailboxes", 10240);
+	p_array_init(&mailboxes, pool, 128);
 	dsync_brain_get_changed_mailboxes(brain, &mailboxes,
 		(brain->flags & DSYNC_BRAIN_FLAG_FULL_SYNC) != 0);
 	brain->mailbox_sync = dsync_brain_msg_sync_init(brain, &mailboxes);
 	dsync_brain_msg_sync_more(brain->mailbox_sync);
+	pool_unref(&pool);
 }
 
 static void
--- a/src/dsync/dsync-proxy-client.c	Wed Oct 28 16:01:06 2009 -0400
+++ b/src/dsync/dsync-proxy-client.c	Wed Oct 28 16:12:06 2009 -0400
@@ -379,16 +379,18 @@
 
 	iter = i_new(struct proxy_client_dsync_worker_msg_iter, 1);
 	iter->iter.worker = _worker;
-	iter->pool = pool_alloconly_create("proxy message iter", 1024);
+	iter->pool = pool_alloconly_create("proxy message iter", 10240);
 
-	str = t_str_new(512);
+	str = str_new(iter->pool, 512);
 	str_append(str, "MSG-LIST");
-	for (i = 0; i < mailbox_count; i++) {
+	for (i = 0; i < mailbox_count; i++) T_BEGIN {
 		str_append_c(str, '\t');
 		dsync_proxy_mailbox_guid_export(str, &mailboxes[i]);
-	}
+	} T_END;
 	str_append_c(str, '\n');
 	o_stream_send(worker->output, str_data(str), str_len(str));
+	p_clear(iter->pool);
+
 	proxy_client_worker_output_flush(_worker);
 	return &iter->iter;
 }