This is the mail archive of the guile@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 objects on the heap?



scm_protect_object and scm_unprotect_object are definitely not
high-performance, and they don't nest.  (They almost certainly ought
to nest.)  The thing is, it's easy to roll your own protect/unprotect
functions that have the right design and performance for your
application --- just make sure there's some path from some guaranteed
live object (perhaps created with scm_permanent_object) to your
objects.

Does anyone out there have code that will break if we change the
semantics of scm_protect_object and scm_unprotect_object so that they
nest?  The proposed behavior is: it is illegal to unprotect an object
more times than it has been protected, and whenever it has been
protected more times than unprotected, the garbage collector will not
collect it.

Note that current behavior is wrong for temporarily protecting an
object while you frob it; when you call scm_unprotect_object, you may
screw up some function below you on the call stack that still needs it
protected.

If there are no objections in a while, I'll make this change.