[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is my procedure getting GCed?

From: Marius Vollmer
Subject: Re: Is my procedure getting GCed?
Date: 01 May 2001 21:46:01 +0200
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

Brett Viren <address@hidden> writes:

> To avoid all this by-hand protecting/unprotecting I instead could
> handle this by accessing all SCM values via a lightweight C++
> Handler class and deal with protect/unprotect by overriding
> operator=().

Another option is to `promote' all your C++ objects to Scheme objects
and have them managed by the GC.  You would do this with `smobs'.  For
each of your classes, you would have to write a `marking' routine that
call `scm_gc_mark' on all SCM objects contained in an instance of this
class.  The instance itself will be wrapped in a smob and passed
around as a SCM, too.  This might be more efficient than using
protect/unprotect as well.

By using C++ inheritance and virtual functions, you might be able to
hide some of the hair.

Now you would make sure that the GC sees each of your instances, which
might or might not be easier than having it see the SCM data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]