From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AB06F431FAF for ; Mon, 10 Dec 2012 19:35:08 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eJS4H4iTyBEm for ; Mon, 10 Dec 2012 19:35:08 -0800 (PST) Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 08044431FAE for ; Mon, 10 Dec 2012 19:35:07 -0800 (PST) Received: from fctnnbsc30w-142167090129.dhcp-dynamic.fibreop.nb.bellaliant.net ([142.167.90.129] helo=zancas.localnet) by tesseract.cs.unb.ca with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1TiGcb-0000gD-08; Mon, 10 Dec 2012 23:35:06 -0400 Received: from bremner by zancas.localnet with local (Exim 4.80) (envelope-from ) id 1TiGcV-0007ki-Fq; Mon, 10 Dec 2012 23:34:59 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Subject: [PATCH] _notmuch_message_index_file: unref (free) address lists from gmime. Date: Mon, 10 Dec 2012 23:33:40 -0400 Message-Id: <1355196820-29734-1-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1355188740-6663-1-git-send-email-david@tethera.net> References: <1355188740-6663-1-git-send-email-david@tethera.net> X-Spam_bar: - Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Dec 2012 03:35:08 -0000 From: David Bremner 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