How to completely remove a TFile from gROOT

and will be worse if there are a lot of different factory objects.

you can mitigate this by having a single Configuration object that contains all the factory objects.

But I’m assuming TFile::~TFile() will automatically write every objects (like TTree), is that the case?

TFile::~TFile() intentionally does not write the object. The TFile destructor might be called either in normal cases or abormal cases (an error happened). Especially in the second case, we can’t tell whether the user would want the objects to be written or the file left as is (eg the new data is corrupted and the user wants to keep the old ones.

TFile::~TFile() intentionally does not write the object.

Ah…OK, so every objects must be written into TFile before ROOT libs been unloaded, otherwise nothing new will be written when gROOT clean up all TFile during TROOT::~TROOT()

Yes, you are completely correct.

Thank you, now I fully understood! :smiley:

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