Re: [Rcpp-devel] Possible regression in R-3.2.3 or Rcpp 0.12.3

2016-01-30 Thread Dirk Eddelbuettel
On 30 January 2016 at 13:58, Kevin Ushey wrote: | And I now have a MRE: | | #include | using namespace Rcpp; | | // [[Rcpp::export]] | IntegerVector ouch(IntegerVector x, IntegerVector y) { | IntegerVector result; | result = x[y - 1]; | return result; | } | | /*** R | x <- 1:1E6 | y <- 1

Re: [Rcpp-devel] Possible regression in R-3.2.3 or Rcpp 0.12.3

2016-01-30 Thread Kevin Ushey
And I now have a MRE: #include using namespace Rcpp; // [[Rcpp::export]] IntegerVector ouch(IntegerVector x, IntegerVector y) { IntegerVector result; result = x[y - 1]; return result; } /*** R x <- 1:1E6 y <- 1:1E6 gctorture(TRUE) x <- ouch(x, y) gctorture(FALSE) */ This fails pretty rel

Re: [Rcpp-devel] Possible regression in R-3.2.3 or Rcpp 0.12.3

2016-01-30 Thread Kevin Ushey
I think I know what's going on now. Effectively, we're 'evaluating' the sugar proxy vector, getting a pointer to a (temporary, unprotected) R data structure, and then storing that pointer. Later, when we attempt to allocate the output vector (with `no_init`) the GC runs and cleans up our pointer.

Re: [Rcpp-devel] Possible regression in R-3.2.3 or Rcpp 0.12.3

2016-01-30 Thread Qiang Kou
Another thing confused me is the segfault only happens when the IntegerVector is significantly long. Best, KK On Sat, Jan 30, 2016 at 2:57 AM, Kevin Ushey wrote: > Hmm, I have one thought: we try to re-use the indices from an > IntegerVector, but the type here is actually a sugar type: > >