guile-user
[Top][All Lists]
Advanced

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

Re: Garbage Collection questions


From: Sam Tregar
Subject: Re: Garbage Collection questions
Date: Sun, 13 May 2001 18:31:25 -0400 (EDT)

On Sun, 13 May 2001, Sam Tregar wrote:

>    bind $foo to SCM "bar" -> scm_protect
>    bind $baz to SCM "bar" -> scm_protect
>    destroy $foo           -> scm_unprotect
>    SCM "bar" GC'd
>    destroy $bar           -> scm_unprotect (core dump)
>
> Ugh.  I've got a few ideas on how to address this but none of them are
> pretty.

Ok, I'm a fool.  I guess this works just the way I'd hoped -
protect/unprotect maintain a count and nest properly.   Of course, I did
have to read gc.c to find that out!

This stuff should definitely be documented better.  I'm willing to do some
doc-migration of useful stuff from gc.c into a relevent .texi file.  Can
someone point me to the right file and section?

> How do I know if a C variable is in the registers or not?  Isn't that
> something the compiler keeps you from knowing at any given point?  Are
> there some simple rules I can learn as to wether an SCM created in C needs
> protection?

gc.c also had some interesting comments on this question - the
scm_remember_upto_here functions are a very strange hack indeed!  It seems
that a sufficiently intelligent optimisizing compiler could defeat this
mechanism...

So, I know enough now to not be so worried.  Thanks.

-sam




reply via email to

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