On Wed, Sep 7, 2011 at 10:48 PM, Austin Clements <amdragon at mit.edu> wrote: > *snip* > > I'm a bit confused by the reference tree you drew. ?The 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.