R-alpha: long term wishes

Thomas Lumley thomas@biostat.washington.edu
Fri, 12 Sep 1997 10:00:17 -0700 (PDT)


I have two difficult but not impossible suggestions for long-term
improvements to memory handling in R.

The first is in foreign function calling.  It would sometimes save a lot
of time if you could designate arguments to to .C/.Fortran as input or
output only (like Fortran 90 INTENT IN/OUT descriptions).  At the moment
every argument to foreign code is copied into a non-relocatable area, then
copied back into a new R variable.  If a variable was INTENT IN, it would
not be copied back, and that element of the return value would be NULL; if
a variable was INTENT OUT it would not be copied in and R would just
malloc() the correct amount of space in the non-relocatable area.  I've
been writing quite a bit of C code that turns huge matrices into small
ones, involving a lot of memory movement that could easily be removed.
The default would have to still be copying everything, for backwards
compatibility and idiotproofing.

The second, more difficult suggestion, is to do something other than stop
when memory is exhausted.  It doesn't matter if what you do is slow, as
the alternative is complete failure.  It should be possible for R to try
and grab a bigger chunk of memory (perhaps 50-100% bigger) and move into
it.  The relocatable part of the heap wouldn't be a big problem but the
non-relocatable part would need to be kept where it was and a new one
started.  On the other hand, this probably requires rewriting a whole
bunch of stuff and might be very painful.


	-thomas


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-