Re: [PATCH 02/11] lib: Refactor _notmuch_database_link_message

Subject: Re: [PATCH 02/11] lib: Refactor _notmuch_database_link_message

Date: Mon, 6 Oct 2014 09:25:16 -0400

To: David Bremner

Cc: notmuch@notmuchmail.org

From: Austin Clements


Quoth David Bremner on Oct 06 at  8:04 am:
> Austin Clements <aclements@csail.mit.edu> writes:
> 
> > Quoth David Bremner on Oct 05 at  9:45 am:
> >> Austin Clements <aclements@csail.mit.edu> writes:
> >> > +    void *local = talloc_new (NULL);
> >> 
> >> What's the advantage of using a local talloc context here? Is this just
> >> an optimization?
> >
> > There are a few allocations that wind up going in to this local
> > context because of the call to _consume_metadata_thread_id, so it's
> > more convenient to free this one context on return from
> > _notmuch_database_link_message than to worry about tracking these
> > various allocations.
> 
> OK, but wouldn't the lazy solution be to use message as a talloc
> context?

That would be the lazy solution, but it would also leak a bunch of
allocations that don't need to live past the end of
_notmuch_database_link_message.

Thread: