Hello, I am trying to use the line to make TH1F histograms:
A_TTree->Draw(variable>>name(10,0,1),wgt,"goff");
There are no problem of making the task done. However, it seems to occupy some memory that cannot be deleted, even I have tried different methods to free the histograms. It becomes a problem when I repeat this more than (about) 700 times on my end.
I do a test by only making a few histograms. The memory keeps building up even the function with this line is finished or the root file is closed.
The only way to drop the memory is to end the program entirely, so I think this is a bug that needs to be fixed. Or is there anything I can do about it?
Hi,
and welcome to the ROOT forum. Each TTree::Draw invocation just-in-time-compiles C++ code that implements your histogram filling/variable selection. That compiled code will reside in memory until program exits.
An alternative that does not use just-in-time compilation (because the template parameters of Histo1D are explicitly specified):
auto h = ROOT::RDataFrame("treename", "filename.root").Histo1D<double, double>("variable", "weight");
This code should not lead to an increase in memory after you delete the histogram. Can you provide a complete running example that shows the memory increase?