]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Memory usage tweaks.
authorTimo Sirainen <tss@iki.fi>
Wed, 28 Oct 2009 20:12:06 +0000 (16:12 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 28 Oct 2009 20:12:06 +0000 (16:12 -0400)
--HG--
branch : HEAD

src/dsync/dsync-brain.c
src/dsync/dsync-proxy-client.c

index 8436ba2d75b550b7e731117bf8f9a2992b7be8d6..3f524cb12ac03bfe24f3199cc6f8730321f24c17 100644 (file)
@@ -333,12 +333,15 @@ dsync_brain_get_changed_mailboxes(struct dsync_brain *brain,
 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
index 38c7b9e802e7e9644ddefd64547d24717401710d..774b0868404de14bf2c9d099a54d73f925069723 100644 (file)
@@ -379,16 +379,18 @@ proxy_client_worker_msg_iter_init(struct dsync_worker *_worker,
 
        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;
 }