This is the mail archive of the guile@cygnus.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: [LONG] Re: Calling Scheme from C and Garbage Collection



> > Maybe you are keeping a pointer to a SCM value that is not protected
> > from gc?  After you allocate a compiled regexp, how do you make sure
> > that it never gets gc'ed?  Maybe all you need is a scm_protect_obj().
> > 
> That was it ! (strangely I missed it when I read the source.)
> 
> Thanks a lot for your help.

If you call scm_protect_object on an object, make sure you call
scm_unprotect_object on it when you're done with it.  Otherwise, the
GC will never see it.