[Top][All Lists]

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

Re: scm_gc_unprotect during GC

From: Han-Wen Nienhuys
Subject: Re: scm_gc_unprotect during GC
Date: Fri, 24 Sep 2004 11:24:42 +0200

address@hidden writes:
> Han-Wen Nienhuys <address@hidden> writes:
> > A short term solution is to make sure that LilyPond never does
> > scm_gc_unprotect_object() from smobbed destructor. However, I feel
> > that this is a kludge.
> >
> > Either scm_gc_unprotect_object is callable during sweep, or this is
> > forbidden. At present, GUILE does not print a warning, but barfs in an
> > unrelated location.
> Yes, that's unfortunate.  Almost anything is forbidden during sweep,
> and we need to document that more clearly.

In other words, scm_gc_unprotect_object should check whether sweep is
in progress, and halt if that is the case. I added this change.

> I'd say that a smob free function should not call
> scm_gc_unprotect_object, or any other function that accesses the
> heap.  The heap might be in an inconsistent state, etc.  We probably
> should list all functions that are callable, starting with just
> scm_gc_free.
> Why do you need to call scm_gc_unprotect_object from your smob free
> function?  To release a SCM value that was in use by the smob?  The
> usual way to do that is to mark that value in the smob mark function.

Laziness, I suppose. We have a precooked Protected_scm class that
takes care of calling protect and unprotect. I've changed all our
smobs to stop using it.


 Han-Wen Nienhuys   |   address@hidden   | 

reply via email to

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