unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: Re: [PATCH 4/4] perf-test: add memory leak test for dump restore
Date: Sun, 16 Dec 2012 18:14:56 -0400	[thread overview]
Message-ID: <87obht4pb3.fsf@zancas.localnet> (raw)
In-Reply-To: <1355682208-13729-5-git-send-email-david@tethera.net>

david@tethera.net writes:
> +
> +memory_run 'load nmbug tags' 'notmuch restore --accumulate --input=corpus.tags/nmbug.sup-dump'
> +memory_run 'dump *' 'notmuch dump --output=tags.sup'
> +memory_run 'restore *' 'notmuch restore --input=tags.sup'
> +memory_run 'dump --format=batch-tag *' 'notmuch dump --format=batch-tag --output=tags.bt'
> +memory_run 'restore --format=batch-tag *' 'notmuch restore --format=batch-tag --input=tags.bt'
> +

We were talking on IRC about how/if valgrind would cope with talloc, and
the possibility that chunks of memory are still reachable by talloc, but
not by user code.  Currently the talloc context "local" in main() is
(slightly perversely) only freed in the case of "return 1", so all the
memory allocated by talloc on that contex is shown as leaked:

 3,005,500 (93 direct, 3,005,407 indirect) bytes in 1 blocks are definitely lost in loss record 553 of 553
    at 0x4C2A26B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by 0x55F14C7: talloc_strndup (in /usr/lib/x86_64-linux-gnu/libtalloc.so.2.0.7)
    by 0x4115E8: parse_sup_line (notmuch-restore.c:90)
    by 0x411AD4: notmuch_restore_command (notmuch-restore.c:209)
    by 0x40B2A4: main (notmuch.c:294)

Although this is probably a bug in main(), it does point valgrind to the
right culprit.

As our memory allocation is (alas) a mix of talloc, malloc, and
g_malloc, we probably need both valgrind tests, and some way to toggle
talloc memory debugging.  (
http://talloc.samba.org/talloc/doc/html/group__talloc__debug.html )

d

      reply	other threads:[~2012-12-16 22:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-16 18:23 memory leak tests david
2012-12-16 18:23 ` [PATCH 1/4] perf-test: remove redunant "initial notmuch new" david
2012-12-16 18:23 ` [PATCH 2/4] perf-test: rename current tests as "time tests" david
2012-12-16 18:23 ` [PATCH 3/4] perf-test: initial version of memory test infrastructure david
2012-12-16 19:11   ` Austin Clements
2012-12-16 18:23 ` [PATCH 4/4] perf-test: add memory leak test for dump restore david
2012-12-16 22:14   ` David Bremner [this message]

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=87obht4pb3.fsf@zancas.localnet \
    --to=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).