Re: [PATCH 1/2] CLI/reindex: fix memory leak

Subject: Re: [PATCH 1/2] CLI/reindex: fix memory leak

Date: Wed, 17 Apr 2019 20:04:36 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Mon, Apr 15 2019, David Bremner wrote:

> 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);

This particular change looks trivial to me...

Tomi

>      }
>  
>      if (!ret)
> -- 
> 2.20.1
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: