unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Sebastian Spaeth <Sebastian@sspaeth.de>
To: Austin Clements <amdragon@MIT.EDU>
Cc: Bertram Felgenhauer <bertram.felgenhauer@googlemail.com>,
	Bart Massey <bart@cs.pdx.edu>, notmuch <notmuch@notmuchmail.org>
Subject: Re: Memory management practices
Date: Fri, 09 Sep 2011 11:27:55 +0200	[thread overview]
Message-ID: <8762l22hgk.fsf@SSpaeth.de> (raw)
In-Reply-To: <20110908151557.GM5688@mit.edu>

[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]

On Thu, 8 Sep 2011 11:15:57 -0400, Austin Clements <amdragon@MIT.EDU> wrote:
> In general, a garbage collector can't make any guarantees about
> finalization order.  When a collection of objects all become
> unreachable simultaneously (for example, the last reference to any
> Messages object is dropped, causing the Query object and the Message
> object to both become unreachable), the garbage collector *could*
> finalize the Query first (causing talloc to free the
> notmuch_messages_t) and then the Messages object (causing it to
> crash).  There's no guarantee in general because, in the presence of
> cycles, there is no meaningful finalization order.

Right, but that should not pose a problem for python. If e.g. both a
Query and derived Message objects become unreachable, the python objects
would not care which object is ditched and deleted first. Currently, it
seems that we finalize the Messages first, and the Query second. But we
would not fail if the Query were finalized first. Granted, the
underlying libnotmuch Message objects were torn away while the python
Message objects were still around. But they would ultimately also be
sweeped away, and that would not cause any problems.

But I am sure that I am missing out something. I'll leave this
discussion to the pros :-).

Sebastian

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2011-09-09  9:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 16:32 Memory management issue in notmuch-haskell bindings Ben Gamari
2011-08-28 21:27 ` Bug in GC's ordering of ForeignPtr finalization? Ben Gamari
2011-08-29  3:26   ` Antoine Latter
2011-08-29  3:47     ` Ben Gamari
2011-08-29  4:03       ` Antoine Latter
     [not found]   ` <20110829183010.GA2605@24f89f8c-e6a1-4e75-85ee-bb8a3743bb9f>
2011-08-29 20:30     ` Memory management practices Ben Gamari
2011-09-07 20:36       ` Ben Gamari
2011-09-08  2:48         ` Austin Clements
2011-09-08  3:05           ` Austin Clements
2011-09-08 13:50             ` Sebastian Spaeth
2011-09-08 15:15               ` Austin Clements
2011-09-09  9:27                 ` Sebastian Spaeth [this message]
2011-09-09 17:53                   ` Austin Clements
2011-09-11 21:47                     ` Ben Gamari
2011-09-12  2:18                       ` Austin Clements
2011-09-12 12:30                     ` Sebastian Spaeth

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=8762l22hgk.fsf@SSpaeth.de \
    --to=sebastian@sspaeth.de \
    --cc=amdragon@MIT.EDU \
    --cc=bart@cs.pdx.edu \
    --cc=bertram.felgenhauer@googlemail.com \
    --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).