bug-guile
[Top][All Lists]
Advanced

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

bug#20907: [PATCH] Manual bug for scm_gc_protect_object


From: Ludovic Courtès
Subject: bug#20907: [PATCH] Manual bug for scm_gc_protect_object
Date: Wed, 02 Sep 2015 14:08:52 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Mark H Weaver <address@hidden> skribis:

> Mike Gran <address@hidden> 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’.





reply via email to

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