[Ecls-list] How to hook into the CLOS object destruction process initiated by the garbage collector?
Dietrich Bollmann
dietrich at formgames.org
Thu Jun 13 05:33:43 UTC 2013
Hi Matt,
On Thu, Jun 13, 2013 at 10:38 AM, Matthew Mondor <mm_lists at pulsar-zone.net>
wrote:
> On Thu, 13 Jun 2013 10:30:33 +0900
> Dietrich Bollmann <dietrich at formgames.org> wrote:
>
> > 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).
>
Thank you very much for your answer!
And sorry for writing three unnecessary emails! I found your reply just
now - after writing my second email :(
On Thu, Jun 13, 2013 at 10:38 AM, Matthew Mondor <mm_lists at pulsar-zone.net>
wrote:
>
> If you need more performance and predictability, you may want to
> provide some WITH-* style macros internally using UNWIND-PROTECT as well
>
Thanks for this as well!
I will think about it - and thank you for providing this extra information
which gives my question some sense at least :)
All the best, Dietrich
On Thu, Jun 13, 2013 at 10:38 AM, Matthew Mondor
<mm_lists at pulsar-zone.net>wrote:
> 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
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Ecls-list mailing list
> Ecls-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ecls-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130613/967ca7fa/attachment.html>
More information about the ecl-devel
mailing list