Use of big arrays in root macro

Dear all,

I am trying to allocate large arrays within a root macro (such as with

    int * PB_all = new int[(50000)*20];
    int ** PointedBy = new int*[20];
    for (int i=0; i<20; i++) {
      PointedBy[i]=PB_all+(50000)*i;
    }

Unfortunately, I seem to be unable to run with arrays larger than 50000*20 or so. The macro does not eat up much more memory from other variables.
How do i get around this problem? Is there a way to allocate large amounts of memory for the macro?
Thank you
Tommaso


ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


You can save data to a TTree in a ROOT file, and access data one by one with GetEntry() method.

Hi,
what’s your ROOT version, and what’s the error or the problem you encounter?

I just tried to execute the following macro on ROOT master and it ran just fine:

// macro.cpp, executed as `root -l -b -q macro.cpp`
void macro() {
    int * PB_all = new int[(100000)*20];
    int ** PointedBy = new int*[20];
    for (int i=0; i<20; i++) {
      PointedBy[i]=PB_all+(100000)*i;
   }
}

Cheers,
Enrico

Thanks - but will that not be very slow?
T.

No, it will be pretty fast in your case.