unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <aclements@csail.mit.edu>
To: david@tethera.net, notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: Re: [PATCH] _notmuch_message_index_file: unref (free) address lists from gmime.
Date: Mon, 24 Dec 2012 15:32:46 -0500	[thread overview]
Message-ID: <87txrbkx75.fsf@awakening.csail.mit.edu> (raw)
In-Reply-To: <1355196820-29734-1-git-send-email-david@tethera.net>

This patch LGTM.

On Mon, 10 Dec 2012, david@tethera.net wrote:
> From: David Bremner <bremner@debian.org>
>
> Apparently as of GMime 2.4, you don't need to call
> internet_address_list_destroy anymore, but you still need to call
> g_object_unref (from the GMime Changelog).
>
> On the medium performance corpus, valgrind shows "possibly lost"
> leakage in "notmuch new" dropping from 7M to 300k.
> ---
>  lib/index.cc |   12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/lib/index.cc b/lib/index.cc
> index da0e6ce..a2edd6d 100644
> --- a/lib/index.cc
> +++ b/lib/index.cc
> @@ -484,12 +484,18 @@ mboxes is deprecated and may be removed in the future.\n", filename);
>      }
>  
>      from = g_mime_message_get_sender (mime_message);
> -    addresses = internet_address_list_parse_string (from);
>  
> -    _index_address_list (message, "from", addresses);
> +    addresses = internet_address_list_parse_string (from);
> +    if (addresses) {
> +	_index_address_list (message, "from", addresses);
> +	g_object_unref (addresses);
> +    }
>  
>      addresses = g_mime_message_get_all_recipients (mime_message);
> -    _index_address_list (message, "to", addresses);
> +    if (addresses) {
> +	_index_address_list (message, "to", addresses);
> +	g_object_unref (addresses);
> +    }
>  
>      subject = g_mime_message_get_subject (mime_message);
>      _notmuch_message_gen_terms (message, "subject", subject);
> -- 
> 1.7.10.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

  parent reply	other threads:[~2012-12-24 20:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-11  1:19 [PATCH] notmuch_message_file_get_header: replace free with g_free david
2012-12-11  3:33 ` [PATCH] _notmuch_message_index_file: unref (free) address lists from gmime david
2012-12-11  4:55   ` Tomi Ollila
2012-12-24 20:32   ` Austin Clements [this message]
2012-12-24 23:06   ` David Bremner
2012-12-11  4:50 ` [PATCH] notmuch_message_file_get_header: replace free with g_free Tomi Ollila

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=87txrbkx75.fsf@awakening.csail.mit.edu \
    --to=aclements@csail.mit.edu \
    --cc=bremner@debian.org \
    --cc=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).