This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Again: Guile + Boehm's gc


Clark McGrew <mcgrew@ale.physics.sunysb.edu> writes:

> If you stick an SCM into a global:
> [...] 
> Or if you stick an SCM into a malloced structure:

These are valid uses of scm_protect and scm_unprotect.  However, it is
possible to use these functions less frequently.

When protecting a global variable, you can allocate a cons cell
once, protect it, and then store your global value in the car or cdr
of the cell.  This should be cheaper than calling scm_protect and
scm_unprotect for every change of the variable.

A malloced structure is probably best handled by defining a smob and
then writing an appropriate mark procedure.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]