Memory-leak in root

   gROOT->LoadMacro("/home/nasir/alice/AliPhysics/PWGLF/SPECTRA/UTILS/YieldMean.C");
   TH1 *hOut_t =YieldMean(h_1,h_2,fitFcn ,min , max , loprecision, hiprecision ,  opt,logfilename, minfit, maxfit);

   for (Int_t ip =0; ip < 9;ip++) {
      cout << hOut_t->GetBinContent(ip+1) << endl;
      cout << hOut_t->GetBinContent(ip+1) << endl;
   }
   hOut_t->Draw();

output:

Trial: 10
FIT DOES NOT CONVERGE IN LINE 263
Warning in <TROOT::Append>: Replacing existing TH1: hlo (Potential memory leak).
Warning in <TROOT::Append>: Replacing existing TH1: hhi (Potential memory leak).

Please help! me to get rid from this meory leak warning.

Very likely you are creating several times the histograms hlo and hhi.
The doesn’t show in the piece of code you posted but that’s what it means.

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