unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Lisp object that refers to a C struct
Date: Wed, 17 Oct 2012 23:02:45 +0200	[thread overview]
Message-ID: <83a9vk3j7u.fsf@gnu.org> (raw)
In-Reply-To: <jwv7gqoj18o.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: emacs-devel@gnu.org
> Date: Wed, 17 Oct 2012 16:27:39 -0400
> 
> >> The code to free the C struct will be the one you write
> >> specifically for it, nobody else knows how to free it.
> > Then the code that GC's this new Lisp object will have to be entirely
> > specific to the layout of the struct I'm using, right?
> 
> I said "free" not "GC's".  The GC decide what to free, and takes care of
> freeing most of the objects in the heap.  The code that frees
> the Lisp_Misc file-watcher will be the generic GC code.  And that
> generic code will have to trigger your specific code that frees the
> C struct.
> 
> > It won't be suitable even for the similar-but-different inotify code,
> > right?
> 
> Depends, you can make it generic by having the Lisp_Misc object have
> 2 slots: one containing the pointer to the C struct and another pointing
> to the matching freeing function.

OK, but who will call this freeing function?  E.g., I don't see a call
to free_misc in gc_sweep, it just puts every Lisp_Misc on the free
list.  Do I add the call to the freeing function in gc_sweep, similar
to the call to unchain_marker for markers?



  reply	other threads:[~2012-10-17 21:02 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 21:24 Lisp object that refers to a C struct Eli Zaretskii
2012-10-16  1:07 ` Stefan Monnier
2012-10-16  3:53   ` Eli Zaretskii
2012-10-16 13:11     ` Stefan Monnier
2012-10-16 17:22       ` Eli Zaretskii
2012-10-16 21:43         ` Stefan Monnier
2012-10-17  4:05           ` Eli Zaretskii
2012-10-17  6:21             ` Stephen J. Turnbull
2012-10-17 15:50               ` Eli Zaretskii
2012-10-17 17:45                 ` Stephen J. Turnbull
2012-10-17 13:34             ` Stefan Monnier
2012-10-17 16:08               ` Eli Zaretskii
2012-10-17 20:23                 ` Stefan Monnier
2012-10-17 20:46                   ` Eli Zaretskii
2012-10-17 22:08                     ` Paul Eggert
2012-10-18  0:22                       ` Stefan Monnier
2012-10-18  3:43                         ` Stephen J. Turnbull
2012-10-18  4:50                       ` Eli Zaretskii
2012-10-18  7:20                         ` Paul Eggert
2012-10-18 11:09                           ` Eli Zaretskii
2012-10-18 16:42                             ` Paul Eggert
2012-10-18 17:21                               ` Eli Zaretskii
2012-10-18  8:52                         ` Juanma Barranquero
2012-10-18 11:17                           ` Eli Zaretskii
2012-10-18 12:33                             ` Stefan Monnier
2012-10-18 17:16                               ` Eli Zaretskii
2012-10-18 22:09                                 ` Stefan Monnier
2012-10-19  7:14                                   ` Eli Zaretskii
2012-10-19 14:44                                     ` Stefan Monnier
2012-10-19 18:54                                       ` Eli Zaretskii
2012-10-19 21:35                                         ` Stefan Monnier
2012-10-19 22:35                                           ` Eli Zaretskii
2012-10-20  1:52                                             ` Stefan Monnier
2012-10-20  8:34                                               ` Eli Zaretskii
2012-10-17 16:05           ` Eli Zaretskii
2012-10-17 16:59             ` Davis Herring
2012-10-17 20:27             ` Stefan Monnier
2012-10-17 21:02               ` Eli Zaretskii [this message]
2012-10-18  0:23                 ` Stefan Monnier

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://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a9vk3j7u.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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://git.savannah.gnu.org/cgit/emacs.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).