--nsize and --vsize

Nicholas Lee N.J.Lee@statslab.cam.ac.uk
Tue, 13 Apr 1999 13:59:17 +0100 (BST)

On Tue, 13 Apr 1999, Prof Brian Ripley wrote:

> > The flags exist, but in the adage of the lazy programmer, "less
> > keystrokes, means less RSI/bugs."   One nice option would be for R to probe

Here is a quick solution in the R.sh.in file: (Although it might be nicer
to do this via getenv("R_VSIZE") in the system.c) 

[ -f ${HOME}/.Renviron ] && . ${HOME}/.Renviron
[ "$R_VSIZE" != "" ] && ARG_STACK="$ARG_STACK --vsize $R_VSIZE"
[ "$R_NSIZE" != "" ] && ARG_STACK="$ARG_STACK --nsize $R_NSIZE"

exec ${RHOME}/bin/${RBINARY} $ARG_STACK "$@"

The only problem with this is:
$ echo "R_VSIZE=20M" > ~/.Renviron  (or export R_VSIZE=20M)
$ R --vsize 4M
WARNING: invalid v(ector heap)size '4194304' ignored;using default = 20M

R : Copyright 1999, The R Development Core Team

I assume that --(v|n)size should override enviroment defaults?  

So we could fix that, by accepting the second --vsize option from $@,
instead of the first --vsize from the $ARG_STACK. 

That probably means some mickying around with: 

if(value < R_NSize || value > Max_Nsize) 
    REprintf("WARNING: ...
    R_NSize = value;

So what should the default action be?

> > the size of the .RData file, and rather than dieing on you if it's too
> > large, giving you option of loading it with XX extra memory.

Since InitMemory() is called before R_InitialData(), this might be
trickly.  Either involving some magic in the shell script wrapper or
pre-checking the size of the .RData file before calling InitMemory.


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