Skip to content
Browse files

Enabled support for over-allocation in assignment outside vector limits.

git-svn-id: 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information...
luke committed Feb 5, 2017
1 parent 301c9f1 commit 12aa371f88e5ece5015246e4f4b3e0b2b7f21639
Showing with 10 additions and 3 deletions.
  1. +9 −0 doc/NEWS.Rd
  2. +1 −3 src/main/subassign.c
@@ -317,6 +317,15 @@
\item The maximum number of DLLs that can be loaded into R e.g. via
dyn.load can now be increased by setting the environment variable
\code{R_MAX_NUM_DLLS} before starting R.

\item Assigning to an element of a vector beyond the current
length now over-allocates by a small fraction. The new vector is
marked internally as growable, and the true length of the new
vector is stored in the \code{truelength} field. This makes
building up a vector result by assigning to the next element
beyond the current length more efficient, though pre-allocating is
still preferred. The implementation is subject to change and not
intended to be used in packages at this time.

@@ -162,9 +162,7 @@ static SEXP EnlargeVector(SEXP x, R_xlen_t newlen)
/* over-committing by 5% seems to be reasonable, but for
experimenting the environment variable R_EXPAND_Frac can be
used to adjust this */
/**** for now, the default 1.00 preserves the current no
over-commit behavior */
static double expand_dflt = 1.00;
static double expand_dflt = 1.05;
static double expand = 0;
if (expand == 0) {
char *envval = getenv("R_EXPAND_FRAC");

0 comments on commit 12aa371

Please sign in to comment.
You can’t perform that action at this time.