jeudi 7 septembre 2017

*** Error in `/usr/lib/R/bin/exec/R': corrupted size vs. prev_size: 0x00000000028681c0 ***

I am trying to make a tridimensional array in c++ and pass this object to R with Rcpp. For this I have defined some functions in a CPPscript that I call from an Rscript (using sourceCpp from Rcpp) that I execute from linux terminal with a#!/usr/bin/Rscript tag. I have seen in here Multidimensional std::array how to make a bidimensional array with std::vector and I have done the following code copying what is done in this link:

std::vector<std::vector<std::vector<double> > > Result;
 for( int i = 0; i < mcols; ++i ){
  std::vector<std::vector<double> > auxaux;
  for( int j = 0; j < nrows; ++j ){
   std::vector<double> aux;
   aux.resize(ncols);
   auxaux.push_back(aux);
  }
 auxaux.resize(nrows);
 Result.push_back(auxaux);
}

Then I fill the object doing a triple loop. The final object is about 2.7 Gb so int mcols = 4, int nrows = 32000 and aux.size() is 2700 aproximately.

I have tried to do a vector in R of 2.7Gb and I could, I executed the script using a sample of the input objects ( to make output smaller ) and it worked propperly.

What's wrong whith this Error?? How can I solve it?? Thanks!!

Aucun commentaire:

Enregistrer un commentaire