On 27 Sep 2005 13:21:33 +0200, Immanuel Litzroth immanuell@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.