[cffi-devel] CFFI and SBCL

Martin Simmons martin at lispworks.com
Tue Sep 27 14:26:47 UTC 2005


>>>>> On 27 Sep 2005 13:21:33 +0200, Immanuel Litzroth <immanuell at enfocus.be> said:

  Immanuel> * I often need to allocate foreign objects and put them in a lisp struct. I would
  Immanuel> then want to run a finalizer if the struct gets garbage collected, to free the allocated
  Immanuel> memory. A nice interface to the finalizer functionality on different systems would 
  Immanuel> be a great feature for cffi.

How do you keep control over what foreign things point to the foreign objects?

I've found that losing the last reference from Lisp is not usually a guarantee
that the last reference is lost from the foreign side.  Conversely, if you
work around this by deliberately keeping a reference from Lisp to prevent the
foreign object from being finalized, then you probably know exactly when it
should be freed anyway.

-- 
Martin Simmons                              Email: martin at lispworks.com
LispWorks Ltd, St John's Innovation Centre    TEL:   +44 1223 421860
Cowley Road, Cambridge CB4 0WS, England.      FAX:   +44 870 2206189



More information about the cffi-devel mailing list