I am trying to read a file, fill an ntuple with the data inside, and write that data to file. The problem is that there is a lot of data in the file (around 20 million lines, each line has 10 entries or so). When I run my macro, I get the following malloc error:
root.exe(25875) malloc: *** vm_allocate(size=1082036224) failed (error code=3)
root.exe(25875) malloc: *** error: can’t allocate region
root.exe(25875) malloc: *** set a breakpoint in szone_error to debug
I suppose this is telling me that I don’t have enough RAM??? Is there a clever way to get around this (other than buying more RAM)? Is there a way to make root empty its buffer to file (if that is the problem) before the end of the run? Or, if I am completely off base here (probably), can someone explain to me what this error means and how one might get around it?
The essentials of my code are:
TNtuple *ntuple=TNtuple("n","n","x1:x2: ... :angry:10");
TFile *oFile=new TFile("output_file.root","recreate");
ifstream iFile("input_file.txt");
while(iFile>>x1>>x2>> ... >>x10){
ntuple->Fill(x1,x2, ... ,x10);
}
iFile.close();
ntuple->Write();
oFile->Close();
Thanks so much,
Aaron