[Ecls-list] How to hook into the CLOS object destruction process initiated by the garbage collector?
Matthew Mondor
mm_lists at pulsar-zone.net
Thu Jun 13 01:38:36 UTC 2013
On Thu, 13 Jun 2013 10:30:33 +0900
Dietrich Bollmann <dietrich at formgames.org> wrote:
> CLOS relies on a garbage collector to destruct objects which are not
> referenced anymore, so no explicit destructor method is foreseen.
>
> However, when wrapping a C++ class into a CLOS class, the destructor of the
> C++ object has to be called when the CLOS object is garbage collected to
> free the foreign object.
>
> Is there a way to hook into the CLOS object destruction process initiated
> by the garbage collector in order to call the C++ destructor when the CLOS
> object is garbage collected?
It is possible to register finalizers, although they may only execute
when the GC actually discards the objects, thus it cannot execute
predictably (see http://ecls.sourceforge.net/new-manual/ch28s05.html).
If you need more performance and predictability, you may want to
provide some WITH-* style macros internally using UNWIND-PROTECT as well
--
Matt
More information about the ecl-devel
mailing list