[Rd] a couple of ideas/proposals

Luke Tierney luke@nokomis.stat.umn.edu
Wed, 11 Apr 2001 09:14:53 -0500

On Wed, Apr 11, 2001 at 09:29:27AM -0400, Robert Gentleman wrote:
>     Another thing that Byron mentioned is that he is using finalizers
>     quite a lot but that R doesn't do a gc on exit and so these don't
>     always get called (I haven't checked) but I think that might
>     become necessary.

I think what is needed here is a more flexible exit handler mechanism
together with weak references (which I'm hoping to add before too long).

For exit handling right now I think all we have is .Last.  It would be
nice to have something more like the
Tcl_CreateExitHandler/Tcl_DeleteExitHandler mechanism, together with
an appropriate R interface.

Without knowing the details I can't be sure, but I suspect he doesn't
really want a gc, which would only run the finalizers for unreachable
objects (actually might run is a better since there are no guarantees
of timeliness with finalization).  Instead I suspect he would like a
means of making sure all external objects he uses are shut down, even
the reachable ones.  To do that would require keeping track if all
those objects in a way that doesn't prevent GC (i.e. with weak
references) and then running through those externals and shutting them
down in an exit handler routine.


Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
313 Ford Hall, 224 Church St. S.E.           email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch