guile-devel
[Top][All Lists]
Advanced

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

Re: doco scm_remember_upto_1


From: Marius Vollmer
Subject: Re: doco scm_remember_upto_1
Date: 19 Jun 2003 01:36:10 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Kevin Ryde <address@hidden> writes:

>    In a multi-threaded program, the rule is the same.  As far as a
>    given thread is concerned, a garbage collect still only occurs
>    within a memory allocation function, not at an arbitrary time.
>    (Guile waits for all threads to reach a memory function, and holds
>    them there while the collector runs.)

Don't say "memory allocation function", that is too specific.  A GC
can occur in any libguile function, since all of them might eventually
allocate memory or run a async that does so, or simply invoke SCM_TICK
which is also a safe point for stopping a thread.

> >     But when in doubt, be
> >     conservative: include the call to scm_remember_upto_here_1 when
> >     you are not sure that it is safe to leave it out.
> 
> I think I'd rather see something unambiguous said about when a
> remember must be used, instead of talking about being unsure.  I tried
> to reword a little to emphasise it's memory activity which provokes a
> gc.

Hmm, the most concrete I can think of is:

  If there is a call to any libguile function after you have extracted
  the innards of some SCM object (from a smob, or with
  SCM_STRING_CHARS, etc.) you can't count on that innard still being
  there unless the associated SCM is used again later on (and that use
  is not being optimized away), if only by virtue of appearing in a
  call to scm_remember_upto_here.

The "doubt" would come when one isn't sure whether a libguile function
is being called because one doesn't know what kind of stuff third
party functions do.

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405




reply via email to

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