Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3BABD429E27 for ; Tue, 13 Dec 2011 10:19:07 -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 jUQgmt-JDcua for ; Tue, 13 Dec 2011 10:19:06 -0800 (PST) Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66]) by olra.theworths.org (Postfix) with ESMTP id 65722429E25 for ; Tue, 13 Dec 2011 10:19:06 -0800 (PST) Received: by guru.guru-group.fi (Postfix, from userid 501) id E5A886802B; Tue, 13 Dec 2011 20:19:11 +0200 (EET) From: tomi.ollila@iki.fi To: Subject: [PATCH] notmuch: unref charset_filter (once more) to fix one memory leak Date: Tue, 13 Dec 2011 20:18:48 +0200 Message-Id: <1323800328-17014-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 1.7.6.1 In-Reply-To: <877h20wrf3.fsf@gmail.com> References: <877h20wrf3.fsf@gmail.com> Cc: Tomi Ollila 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, 13 Dec 2011 18:19:07 -0000 From: Tomi Ollila In my test case added g_object_unref(charset_filter) reduces memory consumption over 90% when 'notmuch show --format=text "*"' is executed (~11000 messages, RES ~330M -> ~25M). --- Thanks Dmitry. I did not realize unref unreferences, does not deallocate memory/data structures. g_mime_stream_filter_add() takes an additional reference to the charset_filter object. notmuch-show.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/notmuch-show.c b/notmuch-show.c index 873a7c4..8da3295 100644 --- a/notmuch-show.c +++ b/notmuch-show.c @@ -471,9 +471,12 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out) /* This result can be NULL for things like "unknown-8bit". * Don't set a NULL filter as that makes GMime print * annoying assertion-failure messages on stderr. */ - if (charset_filter) + if (charset_filter) { g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter), charset_filter); + g_object_unref (charset_filter); + } + } wrapper = g_mime_part_get_content_object (GMIME_PART (part)); -- 1.7.6.1