This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: Scm_sloppy_assq mostly fixed, still real slow
- To: Jan Nieuwenhuizen <janneke at gnu dot org>
- Subject: Re: Scm_sloppy_assq mostly fixed, still real slow
- From: Han-Wen Nienhuys <hanwen at cs dot uu dot nl>
- Date: Thu, 15 Jun 2000 19:28:11 +0200 (CEST)
- Cc: Mikael Djurfeldt <mdj at mdj dot nada dot kth dot se>,guile at sourceware dot cygnus dot com, djurfeldt at nada dot kth dot se
- References: <xy74s6wp33n.fsf@mdj.nada.kth.se><200006142031.WAA16169@appel.dyndns.org>
- Reply-To: hanwen at cs dot uu dot nl
janneke@gnu.org writes:
> > How do you use these functions in Lilypond?
>
> Typically upon construction(or soon thereafter)/destruction of C++
To shed some further light on Lily's memory handling: Most smobs in
lily smobify and protect themselves, i.e.
Obj::Obj ()
{
self_scm_ = smobify_self();
scm_protect_object (self_scm_);
}
later on, the smob is put into a big scheme list representing the
score and the object is unprotected,
list_ = gh_cons (obj->self_scm_, list_);
scm_unprotect_object (obj->self_scm_);
This used to be quite efficient because there was little
time betweeen protect and unprotected (so unprotected would find the
object quickly, in front of the list.)
It is done in this way, because there might very well be some time
between creation ("new Obj") and list-adding, in which a GC would kill
an object that wasn't yet added to the score list.
Questions:
* How does this scheme fare in the new protect () implementation?
Should we
avoid the temporary protect?
* Is it an error to unprotect an object too many times? I think that
happens occasionally.
--
Han-Wen Nienhuys, hanwen@cs.uu.nl ** GNU LilyPond - The Music Typesetter
http://www.cs.uu.nl/people/hanwen/lilypond/index.html