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
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
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.
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:
>
>