Finds all of the “live”
SCM objects and reclaims for further
use those that are no longer accessible. You normally don’t need to
call this function explicitly. Its functionality is invoked
automatically as needed.
Protects obj from being freed by the garbage collector, when it
otherwise might be. When you are done with the object, call
scm_gc_unprotect_object on the object. Calls to
scm_gc_unprotect_object can be nested, and
the object remains protected until it has been unprotected as many times
as it was protected. It is an error to unprotect an object more times
than it has been protected. Returns the SCM object it was passed.
Note that storing obj in a C global variable has the same effect17.
Unprotects an object from the garbage collector which was protected by
scm_gc_unprotect_object. Returns the SCM object it was passed.
scm_gc_protect_object in that it causes the
collector to always mark the object, except that it should not be
nested (only call
scm_permanent_object on an object once), and
it has no corresponding unpermanent function. Once an object is
declared permanent, it will never be freed. Returns the SCM object it
Create a reference to the given object or objects, so they’re certain to be present on the stack or in a register and hence will not be freed by the garbage collector before this point.
Note that these functions can only be applied to ordinary C local variables (ie. “automatics”). Objects held in global or static variables or some malloced block or the like cannot be protected with this mechanism.
Return an association list of statistics about Guile’s current use of storage.
Return an alist of statistics of the current live objects.
Mark the object x, and recurse on any objects x refers to. If x’s mark bit is already set, return immediately. This function must only be called during the mark-phase of garbage collection, typically from a smob mark function.
In Guile up to version 1.8, C global variables were not
visited by the garbage collector in the mark phase; hence,
scm_gc_protect_object was the only way in C to prevent a Scheme
object from being freed.