emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lisp object that refers to a C struct


From: Eli Zaretskii
Subject: Re: Lisp object that refers to a C struct
Date: Wed, 17 Oct 2012 23:02:45 +0200

> From: Stefan Monnier <address@hidden>
> Cc: address@hidden
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]