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 78017429E27 for ; Tue, 13 Dec 2011 10:24:51 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 0PHJGqyJevKy for ; Tue, 13 Dec 2011 10:24:51 -0800 (PST) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B773F429E25 for ; Tue, 13 Dec 2011 10:24:50 -0800 (PST) Received: by faaa5 with SMTP id a5so475744faa.26 for ; Tue, 13 Dec 2011 10:24:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=0bYYEpqs72Qw5usXcqKQ3nmvpqSuSJw3NOR6dPAOUpk=; b=syP9fTnK8PM7Yv9jqmwwOfhrya2GbRcmM/rnGmB0opBm8CcyUgn6XN+yjlhMjDa7Oz xOCAXP+ud2i2ZS7WYHAPzzwP++2wsajCt/LDSstyKwAyytLPp+pP+YVc2tbUoDctjZK5 JubwUFuNrOMQFydK5czfRLILrmWWZBnba+k+8= Received: by 10.216.132.164 with SMTP id o36mr3309975wei.76.1323800689107; Tue, 13 Dec 2011 10:24:49 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id dd4sm30874971wib.1.2011.12.13.10.24.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 13 Dec 2011 10:24:48 -0800 (PST) From: Dmitry Kurochkin To: tomi.ollila@iki.fi, notmuch@notmuchmail.org Subject: Re: [PATCH] notmuch: unref charset_filter (once more) to fix one memory leak In-Reply-To: <1323800328-17014-1-git-send-email-tomi.ollila@iki.fi> References: <877h20wrf3.fsf@gmail.com> <1323800328-17014-1-git-send-email-tomi.ollila@iki.fi> User-Agent: Notmuch/0.10.2+96~g74e5ae5 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Tue, 13 Dec 2011 22:24:11 +0400 Message-ID: <87wra0uy7o.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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:24:51 -0000 On Tue, 13 Dec 2011 20:18:48 +0200, tomi.ollila@iki.fi wrote: > 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. Looks good to me. Regards, Dmitry > 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 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch