unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/2] CLI/reindex: fix memory leak
Date: Mon, 15 Apr 2019 22:46:15 -0300	[thread overview]
Message-ID: <20190416014616.31623-2-david@tethera.net> (raw)
In-Reply-To: <20190416014616.31623-1-david@tethera.net>

Since message is owned by messages, it was held for the entire run of
the program. This in turn means that the Xapian::Document objects are
not freed, and thus one ends up with (effectively) a copy of one's
entire mailstore in memory when running

       notmuch reindex '*'

Thanks to Olly Betts for the patient help debugging, and the
suggestion of a fix.
---
 notmuch-reindex.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/notmuch-reindex.c b/notmuch-reindex.c
index d8589120..fefa7c63 100644
--- a/notmuch-reindex.c
+++ b/notmuch-reindex.c
@@ -71,6 +71,7 @@ reindex_query (notmuch_database_t *notmuch, const char *query_string,
 	ret = notmuch_message_reindex(message, indexopts);
 	if (ret != NOTMUCH_STATUS_SUCCESS)
 	    break;
+	notmuch_message_destroy (message);
     }
 
     if (!ret)
-- 
2.20.1

  reply	other threads:[~2019-04-16  1:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16  1:46 reindex improvements David Bremner
2019-04-16  1:46 ` David Bremner [this message]
2019-04-17 17:04   ` [PATCH 1/2] CLI/reindex: fix memory leak Tomi Ollila
2019-04-19  2:22   ` David Bremner
2019-04-16  1:46 ` [PATCH 2/2] n_m_remove_indexed_terms: reduce number of Xapian API calls David Bremner
2019-05-22 11:58   ` David Bremner
2019-05-23 11:40   ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416014616.31623-2-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).