Hadd/bad alloc

Hi all,

I have ~280 file.root that I have to merge. Each file contain different things, but the most important is a directory with ~62000 TH1F. Sometimes it fails and I read in the .log:

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.

#6 0x0000000000403b12 in MergeRootfile(TDirectory*, TList*) ()
#7 0x00000000004032cf in MergeRootfile(TDirectory*, TList*) ()
#8 0x0000000000404d1b in main ()

terminate called after throwing an instance of 'std::bad_alloc’
what(): std::bad_alloc

What I do (not interactively) is:
hadd -f final.root list_of_280files.root
but I think that, depending on what kind of other jobs are running on the machine, I have not enough memory for the temporary copy the histograms that is made during the hadd.

It’s true? There is a solution?
For instance: dividing the list of the file to hadd in two parts and merging them separately, and than merge the two outputs, could be helpful?

Thank you,
Luca

Hi,

Yes, this is possible solution. In newer version of ROOT you can also use the -n option to limit the number of files opened at once.:hadd -f -n 50 final.root list_of_280files.root

Cheers,
Philippe.