Long time to close ROOT file with O(500k) histograms



I am trying to write an output ROOT file using the attached macro that contains O(500k) histograms. I see that TFile.Close() function takes a very long time even after the file is written. You can reproduce this with this command:

$ python processHitInfo.py data18_v6.root --save-hists

where the input file is available here:


Please let me know if you cannot reproduce this or have any questions. Thanks for taking a look.


processHitInfo.py (13.1 KB)

Please read tips for efficient and successful posting and posting code

ROOT Version: v6.20.06
Platform: lxplus
Compiler: Not Provided

@pcanal can you please take a look?Thanks!

@rustem I think it could be a valid ROOT bug, can you please open a bug report at Issues · root-project/root · GitHub

To speed up the process and if you are sure that there is no reference to the histogram that need to be indirectly cleaned-up (eg. if you close any Canvases prior to the file closing), you can do:


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