Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / c4 / 80732f5e748f07f02bb416c19bba485d33cf96
1 Return-Path: <too@guru.guru-group.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 3BABD429E27\r
6         for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 10:19:07 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id jUQgmt-JDcua for <notmuch@notmuchmail.org>;\r
16         Tue, 13 Dec 2011 10:19:06 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
18         by olra.theworths.org (Postfix) with ESMTP id 65722429E25\r
19         for <notmuch@notmuchmail.org>; Tue, 13 Dec 2011 10:19:06 -0800 (PST)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id E5A886802B; Tue, 13 Dec 2011 20:19:11 +0200 (EET)\r
22 From: tomi.ollila@iki.fi\r
23 To: <notmuch@notmuchmail.org>\r
24 Subject: [PATCH] notmuch: unref charset_filter (once more) to fix one memory\r
25         leak\r
26 Date: Tue, 13 Dec 2011 20:18:48 +0200\r
27 Message-Id: <1323800328-17014-1-git-send-email-tomi.ollila@iki.fi>\r
28 X-Mailer: git-send-email 1.7.6.1\r
29 In-Reply-To: <877h20wrf3.fsf@gmail.com>\r
30 References: <877h20wrf3.fsf@gmail.com>\r
31 Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
32 X-BeenThere: notmuch@notmuchmail.org\r
33 X-Mailman-Version: 2.1.13\r
34 Precedence: list\r
35 List-Id: "Use and development of the notmuch mail system."\r
36         <notmuch.notmuchmail.org>\r
37 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
38         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
39 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
40 List-Post: <mailto:notmuch@notmuchmail.org>\r
41 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
42 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
44 X-List-Received-Date: Tue, 13 Dec 2011 18:19:07 -0000\r
45 \r
46 From: Tomi Ollila <tomi.ollila@iki.fi>\r
47 \r
48 In my test case added g_object_unref(charset_filter) reduces memory\r
49 consumption over 90% when 'notmuch show --format=text "*"' is\r
50 executed (~11000 messages, RES ~330M -> ~25M).\r
51 ---\r
52 Thanks Dmitry. I did not realize unref unreferences, does not deallocate\r
53 memory/data structures. g_mime_stream_filter_add() takes an additional\r
54 reference to the charset_filter object.\r
55  notmuch-show.c |    5 ++++-\r
56  1 files changed, 4 insertions(+), 1 deletions(-)\r
57 \r
58 diff --git a/notmuch-show.c b/notmuch-show.c\r
59 index 873a7c4..8da3295 100644\r
60 --- a/notmuch-show.c\r
61 +++ b/notmuch-show.c\r
62 @@ -471,9 +471,12 @@ show_text_part_content (GMimeObject *part, GMimeStream *stream_out)\r
63         /* This result can be NULL for things like "unknown-8bit".\r
64          * Don't set a NULL filter as that makes GMime print\r
65          * annoying assertion-failure messages on stderr. */\r
66 -       if (charset_filter)\r
67 +       if (charset_filter) {\r
68             g_mime_stream_filter_add (GMIME_STREAM_FILTER (stream_filter),\r
69                                       charset_filter);\r
70 +           g_object_unref (charset_filter);\r
71 +       }\r
72 +\r
73      }\r
74  \r
75      wrapper = g_mime_part_get_content_object (GMIME_PART (part));\r
76 -- \r
77 1.7.6.1\r
78 \r