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 0AB40429E21 for ; Mon, 12 Sep 2011 05:30:23 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.09 X-Spam-Level: X-Spam-Status: No, score=-0.09 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_MIME_NO_TEXT=0.01] 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 TebOxhx236Bz for ; Mon, 12 Sep 2011 05:30:22 -0700 (PDT) Received: from homiemail-a22.g.dreamhost.com (caiajhbdcagg.dreamhost.com [208.97.132.66]) by olra.theworths.org (Postfix) with ESMTP id 7A891431FB6 for ; Mon, 12 Sep 2011 05:30:22 -0700 (PDT) Received: from homiemail-a22.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTP id B58601A808D; Mon, 12 Sep 2011 05:30:21 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sspaeth.de; h=from:to:cc:subject :in-reply-to:references:date:message-id:mime-version: content-type; q=dns; s=sspaeth.de; b=E7vx0s0zcZfrIVbEC/ZF1L0rWBG sYyHeDTL8z5NgY8xcPqPaUE8hvE5OmbY+aGr/Kb23lY5sCPqK844qdf9TGMXSgZb +GW/BQa5QUMkpg2YInS4Wr9/xNIBlsbe0kxIJ8a57PS+c1ZYAaNGdgC/wfbDhsCV hrP2V0zgegLVoh04= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sspaeth.de; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version: content-type; s=sspaeth.de; bh=1KWAwEp3dMWrpAe7EprwMS3agUo=; b=b 3kyazrdS2Qb/iOCZrdgfRo5prcce1e8A7WkCW0IhcLo/gicAi8Wd22SbRcNVghRg HjdPLlRn0NfllRJq3/cuoNMSpifcVeJmP2m5cnt5CwNxVuF8prGX/xeQDN54jJw7 yLxoZdaEkA9bqh1nPmXC43cNyhcn2OeNSm72zgLFmM= Received: from spaetzbook.sspaeth.de (mtec-hg-docking-1-dhcp-21.ethz.ch [129.132.133.21]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: fax@sspaeth.de) by homiemail-a22.g.dreamhost.com (Postfix) with ESMTPSA id A1F871A8083; Mon, 12 Sep 2011 05:30:19 -0700 (PDT) Received: by spaetzbook.sspaeth.de (sSMTP sendmail emulation); Mon, 12 Sep 2011 14:30:18 +0200 From: Sebastian Spaeth To: Austin Clements Subject: Re: Memory management practices In-Reply-To: <20110909175328.GV5688@mit.edu> References: <8739h1pbaq.fsf@gmail.com> <87pqjprzu2.fsf@gmail.com> <20110829183010.GA2605@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f> <87liucyn7i.fsf@gmail.com> <87aaag3xaf.fsf@gmail.com> <87zkiff8in.fsf@SSpaeth.de> <20110908151557.GM5688@mit.edu> <8762l22hgk.fsf@SSpaeth.de> <20110909175328.GV5688@mit.edu> User-Agent: Notmuch/0.7-19-gee4579a (http://notmuchmail.org) Emacs/23.2.1 (x86_64-pc-linux-gnu) Date: Mon, 12 Sep 2011 14:30:17 +0200 Message-ID: <8739g2q6xy.fsf@SSpaeth.de> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: Bertram Felgenhauer , Bart Massey , notmuch 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: Mon, 12 Sep 2011 12:30:23 -0000 --=-=-= On Fri, 9 Sep 2011 13:53:28 -0400, Austin Clements wrote: > Ah, the *Python* objects don't care, but the underlying C objects do. [...] Thanks for the elaboration. I understand now and agree with the analysis.. > Hence my suggestion that, rather than trying to emulate C-style memory > management in bindings, bindings should create an additional talloc > reference to the underlying objects and rather than calling > notmuch_*_destroy during finalization, they should simply unlink this > additional reference. Agreed, that sounds like a much better option, although it would keep a (underlying C object) for Query and all derived Messages around, even when I explicitely "del query" in python, as long as the python GC keeps any of those Message() objects alive and around, wouldn't it? (which would probably be an ok behavior). But the talloc ref/unref is not exposed through the lib currently, of course. > Then there's also no need to replicate the library's reference > structure in the bindings (though there is a danger of needlessly > delaying free's when the library creates convenience references like > the one from notmuch_query_t to notmuch_messages_t; for these I'd > recommend that the bindings undo such references, which requires a > little knowledge of the library's reference structure, but nothing > beyond what should be documented). Right, that would of course solve the above 'problem'. Sebastian --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk5t+1kACgkQVYX1jMgnoGLXlgCeNcuNFDuXEjaSzhW1df4FWtXf 0o4AnR0M3Hf9SbyHPW/4/6DZqjqsQqWD =Ewc3 -----END PGP SIGNATURE----- --=-=-=--