Turn off tracking of TObjects

Dear ROOTers,

I’d like to use TH1 objects and avoid messages such as
Warning in TROOT::Append: Replacing existing TH1: myVar (Potential memory leak).

More generally, I don’t simply want to remove the message by changing the verbosity level ; I’d like ROOT not to keep track of the objects I create (I have my own management for that).

I thought that calling TObject::SetObjectStat(kFALSE) right after my int main(int,char**) whould disable the tracking (by not using the TObjectTable) but it doesn’t seem to, as I still get the output (which means something internally was able to know that I already had a histogram).

I have a code with a large (huge) number of histograms, and I’d like to avoid any possible overhead, i.e. I’d like to simply use the TH1 functionality without anything else. I don’t plan to Draw or do anything to the hisotgrams ; just save them to a file. I understand that some tracking might be needed to do the latter though, so my question relates to the TH1’s.


P.S. You would have guessed so but I confirm that my code is compiled and linked against ROOT.




Hi Philippe,

Thanks for your reply. Now it seems pretty obvious :slight_smile: