Size of histograms in memory

Hi,
I’m having the following problem:
I have ~8000 root files each containing 8 large histograms (20000 bins, TH1F).
on disk one of the files has 60k and the folder holding all of the files has 60 Mb.
However now I’m trying to load all of these histograms (into my memory).
I open the file, get the hists and do:

TH1F* hist = (TH1F*) rfile->Get((name_+"_reco").c_str());
hist->SetDirectory(0);

and than close the file by:

rfile->Close(“R”);
delete rfile;
rfile = NULL;

However, the 60 Mb blow up in my memory to more than 20 Gb und my program crashes.
Am I doing something wrong or why are the histograms so much larger in memory than on disk?

Appreciating any help!
Cheers,
Miro

I assume your ROOT files are using compression.
Roughly speaking … 8000 files * 8 histograms/file * 20000 bins/histogram * 4 Bytes/bin is something like 4.8GB in RAM. However, if these histograms have Sumw2 then it will double the required size.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.