This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Scm_sloppy_assq mostly fixed, still real slow


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 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]