I have 285 ntuple files (each file about 2GB), and I have to plot 3d histograms from there. So, I added them in TChain. After few hours of run, it crashes with following error:
terminate called after throwing an instance of 'std::bad_alloc' what(): St9bad_alloc
So, I ran again and monitored the memory uses (the computer is multi-code with 32GB RAM, 32bit Linux). Because 32bit does not allow more than 2GB memory/per process, I guess, it started to use swap after filling up 2GB memory. After filling about 1300MB swap, it crashed (swap is 40GB, a lot of space).
The code is simple:
TH3D *dist = new TH3D("dist", "dist", pBin, pMin, pMax, phiBin, phiMin,phiMax,thetaBin,thetaMin, thetaMax); TChain *ch = new TChain("tree"); ch->Add("*.root"); ch->Draw("theta:phi:p >> dist", Cuts);
However for other trees which has few millions less event then this, does not crash.