[Ecls-list] Collecting foreign data

Matthew Mondor mm_lists at pulsar-zone.net
Sat Jun 30 03:40:25 UTC 2012

On Fri, 22 Jun 2012 22:58:13 +0200
Juan Jose Garcia-Ripoll <juanjose.garciaripoll at googlemail.com> wrote:

> On Fri, Jun 22, 2012 at 1:06 PM, Stanislav Frolov <frolosofsky at gmail.com>wrote:
> > Thank you, Matt! I just miss finalization section in the ECL manual.
> I am sorry: the references had disappeared almost entirely due to an
> upgrade of the manual to support Docbook 5.0. If you go back to
> http://ecls.sourceforge.net/new-manual/ you will find again the manual
> pages for ext:get-finalizer and ext:set-finalizer.
> One word of warning, though: finalization has a penalty which is not to be
> ignored. A more performant option might be to have a custom "new" method
> that uses the garbage collector as memory manager. I believe the
> Boehm-Weiser library has examples on how to combine C++ and its collector.

Good to know, I had once read that finalization was costly on SBCL but
thought it was SBCL-specific.  But indeed the manual seems clear about
this problem, now that I looked...

Using the GC-friendly malloc-like primitives?  I guess that is only
possible when we control the library though, rather than obtaining a
pointer from it via FFI?

Another interesting thing to consider is Common Lisp's UNWIND-PROTECT
capability, which can be used with a clean WITH macro to avoid
forgetting to explicitely free/destroy an FFI-pointed object and/or OS
resource, just like WITH-OPEN-FILE, etc...

More information about the ecl-devel mailing list