GNU bug report logs -
#20907
[PATCH] Manual bug for scm_gc_protect_object
Previous Next
Reported by: Mike Gran <spk121 <at> yahoo.com>
Date: Fri, 26 Jun 2015 23:05:02 UTC
Severity: normal
Tags: patch
Done: Andy Wingo <wingo <at> pobox.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Mike Gran <spk121 <at> yahoo.com> writes:
> In the "Garbage Collection" of the manual in both 1.8 and 2.0,
> it says that in 1.8, that "global variables of type SCM ... can be made
> visible to the garbage collector by calling the functions scm_gc_protect".
> (That's a typo I guess. It should say scm_gc_protect_object, I
> think.)
Indeed, good catch! Fixed in 4c5788d1ab14550afd86117e96f91164fbe04a72.
> The implication is that if I do not call scm_gc_protect_object, my
> global is still "invisible" and thus can't be freed by the GC. But my
> "invisible" global in 1.8 is being freed and in 2.0 it is not freed.
Here's the crux of the confusion: it's not the global variable that is
being freed here. The variable only holds a *reference* to the
heap-allocated string. That may seem pedantic, but it's a crucial
distinction here. Anything in the heap that is not referenced from
somewhere visible to the GC is freed.
Would it help to replace all uses of the term "scan" with "mark", in
connection with garbage collection? In the papers I've read on GC,
"mark" is the word I usually see, and it seems much clearer to me,
because anyone who knows the basics of GC knows that "marking" is needed
to prevent an object from being freed, whereas "scanning" could mean
anything.
If you have other ideas of how to make this more clear, I'm open to
suggestions.
Thanks!
Mark
This bug report was last modified 9 years and 28 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.