(guile.info.gz) Garbage Collecting Simple Smobs
Info Catalog
(guile.info.gz) A Common Mistake In Allocating Smobs
(guile.info.gz) Defining New Types (Smobs)
(guile.info.gz) A Complete Example
18.3.6 Garbage Collecting Simple Smobs
--------------------------------------
It is often useful to define very simple smob types -- smobs which have
no data to mark, other than the cell itself, or smobs whose first data
word is simply an ordinary Scheme object, to be marked recursively.
Guile provides some functions to handle these common cases; you can use
this function as your smob type's `mark' function, if your smob's
structure is simple enough.
If the smob refers to no other Scheme objects, then no action is
necessary; the garbage collector has already marked the smob cell
itself. In that case, you can use zero as your mark function.
-- Function: SCM scm_markcdr (SCM X)
Mark the references in the smob X, assuming that X's first data
word contains an ordinary Scheme object, and X refers to no other
objects. This function simply returns X's first data word.
This is only useful for simple smobs created by `SCM_NEWSMOB' or
`SCM_RETURN_NEWSMOB', not for smobs allocated as double cells.
-- Function: size_t scm_free0 (SCM X)
Do nothing; return zero. This function is appropriate for smobs
that use either zero or `scm_markcdr' as their marking functions,
and refer to no heap storage, including memory managed by `malloc',
other than the smob's header cell.
This function should not be needed anymore, because simply passing
`NULL' as the free function does the same.
Info Catalog
(guile.info.gz) A Common Mistake In Allocating Smobs
(guile.info.gz) Defining New Types (Smobs)
(guile.info.gz) A Complete Example
automatically generated byinfo2html