manpagez: man pages & more
info guile
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.5.5 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 immediate 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.

If the smob refers to exactly one other Scheme object via its first immediate word, you can use scm_markcdr as its mark function. Its definition is simply:

SCM
scm_markcdr (SCM obj)
{
  return SCM_SMOB_OBJECT (obj);
}

This document was generated on April 20, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.