Hi there,
I’m experiencing memory leaks with TH1::Fit in Root_5.21.04.
Here’s the isolated glitch :
Int_t nLoops = 10 ;
Int_t nBins = 250000 ;
TH1F *h1 = new TH1F ("h1","h1", nBins,0,nBins) ;
for (Int_t bin=1;bin<=nBins;bin++) { h1->SetBinContent(bin,10.+gRandom->Uniform()) ; }
TF1 *fct = NULL ;
for (Int_t i=0;i<=nLoops;i++)
{
fct = new TF1 ("fct","pol1",0,nBins) ;
h1->Fit("fct","RQ0") ;
delete fct ; fct = NULL ;
}
The memory allocated to Root just gets higher and higher.
Using the “h1->GetFunction(“fct”)” trick from post root.cern.ch/phpBB2/viewtopic.php?t=7386 does not work.
Using Root_5.20.00 (as suggested in root.cern.ch/phpBB2/viewtopic.php?t=5131) solves the problem!
When using “gObjectTable->Print()” with 2 different values for nLoops, namely 10 and 100, the only difference lies in TBackCompFitter! (I get a factor of 10)
Any clue ?
Thanks in advance,
Z