Long processing time for TFile::Close() function

Hello,

I have a question about TFile. I write a large (~40MB) ROOT file consisting of multiple levels of TDirectory objects, each holding around a dozen histograms. I ran a job as a python executable which creates C++ objects using reflex dictionary. Here is a code excerpt for opening and closing a file:

TFile *file = TFile::Open("/tmp/test.root", “RECREATE”);
… create TDirectory and histogram objects
file->Write();
file->Close();

The “Write()” call usually takes a few seconds but the “Close()” function can run for many minutes without visibly touching the file. The file is completely “usable” after the “Write()” call. My question is: why does the “Close()” take so long and do I really need to call this function.

Thank you for your help.

Best,
Rustem

Hi,

Which version of ROOT you are using? Can you try v5.29/02? You can work around the issue by removing your file explicitly from the list of file (gROOT->GetListOfFiles()->Remove(file):wink:

Cheers,
Philippe.

Hi Philippe,

I am using 5.26/00e. Your suggestion worked, the file is now closed within seconds. I do not have an easy access to v5.29/02 since I am compiling my code against ATLAS builds. I have tried setting up 5.29 but the code crashes when running because of version mismatches for underlaying Athena framework classes.

Thank you,
Rustem