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
Mark H Weaver <mhw <at> netris.org> skribis:
> Mike Gran <spk121 <at> yahoo.com> writes:
>> Manual claims C globals weren't scanned by GC in 1.8. The opposite
>> is true.
>
> Ludovic wrote that text in 2009, commit
> f07c349eb38d6c7b160b8980fc4007fb502e3433.
I think the manual is correct: global C variables were *not* scanned by
the GC. As an example, see ‘scm_sys_protects’ in 1.8: It’s a global
array that was explicitly scanned by the GC, because that’s basically
the only mechanism to add new GC root:
j = SCM_NUM_PROTECTS;
while (j--)
scm_gc_mark (scm_sys_protects[j]);
The 1.8 manual reads:
Other references to 'SCM' objects, such as global variables of type
'SCM' or other random data structures in the heap that contain fields of
type 'SCM', can be made visible to the garbage collector by calling the
functions 'scm_gc_protect' or 'scm_permanent_object'. You normally use
these funtions for long lived objects such as a hash table that is
stored in a global variable. For temporary references in local
variables or function arguments, using these functions would be too
expensive.
http://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Garbage-Collection.html
So I think we can close as ‘notabug’? :-)
Ludo’.
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.