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 B12AB431FD0 for ; Wed, 7 Sep 2011 20:05:20 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.699 X-Spam-Level: X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-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 yof7VG3kmCQX for ; Wed, 7 Sep 2011 20:05:20 -0700 (PDT) Received: from mail-vx0-f181.google.com (mail-vx0-f181.google.com [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 3561B431FB6 for ; Wed, 7 Sep 2011 20:05:20 -0700 (PDT) Received: by vxh7 with SMTP id 7so311770vxh.26 for ; Wed, 07 Sep 2011 20:05:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=/eMeG0uDEsEzbaZkutfYAAc2qBcBYg7Tohc6I24rsNQ=; b=Wx2BpeD5ZUZC/yitSTv7fyYXV5BxGUzc1R0ch8Hm7gPQZpVO8yyUSNOyJw5u1ZTwF7 MfbV6acZ3Au2RIcSqiqUALLS1qGYvSCZB0lVRQcIWzUsM6VDI9gKLIMGjkheMkCe5+oM UpnUNWzfWxt00yS4Z/6o4QuUQweNt5sk7OCfE= MIME-Version: 1.0 Received: by 10.220.189.137 with SMTP id de9mr38051vcb.171.1315451119432; Wed, 07 Sep 2011 20:05:19 -0700 (PDT) Sender: amdragon@gmail.com Received: by 10.220.178.132 with HTTP; Wed, 7 Sep 2011 20:05:19 -0700 (PDT) In-Reply-To: References: <8739h1pbaq.fsf@gmail.com> <87pqjprzu2.fsf@gmail.com> <20110829183010.GA2605@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> <87liucyn7i.fsf@gmail.com> <87aaag3xaf.fsf@gmail.com> Date: Wed, 7 Sep 2011 23:05:19 -0400 X-Google-Sender-Auth: JJ252JQDsE8-erOKqHXz9JSi04k Message-ID: Subject: Re: Memory management practices From: Austin Clements To: Ben Gamari Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Bertram Felgenhauer , notmuch , Bart Massey 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: Thu, 08 Sep 2011 03:05:20 -0000 On Wed, Sep 7, 2011 at 10:48 PM, Austin Clements wrote: > *snip* > > I'm a bit confused by the reference tree you drew. =A0The references in > the underlying libnotmuch objects are the other way around. > notmuch_query_t holds a talloc reference to every notmuch_messages_t > it produces, not the other way around. Sorry, I went back and re-read your earlier messages and now I see why your references were the way they were. I stand by the rest of my previous message though. I think the technique used in the Python bindings only works because Python's GC happens to finalize in a particular order (though I doubt that's guaranteed, and could easily not be the case if you stray into the realm of its cycle collector). In general, it seems like approach is trying to recreate C-like memory management and is fragile as a result, whereas talloc should, I think, allow bindings to express their runtime's memory management rather naturally.