I initialize a pointer to a histogram with this line of code:
TH1D *h = new TH1D();
I then enter a for loop. With each iteration of the for loop h points to a different histogram contained inside of a root file.
h=(TH1D*)rootfile->Get(histname);
Where rootfile is a TFile and histname is a pointer to a character array.
After h is assigned a new histogram the histogram goes through several operations before it is added to a TObjArray and the process starts over.
My code works and the final product is good, however, I end up with this warning for each iteration of the for loop.
Warning in : Replacing existing histogram: ****** (Potential memory leak).
Where ******* represents the name of the histogram.
I have tried deleting the pointer to a histogram at the end of each iteration of the for loop and I have tried freeing the pointer at the end of each iteration of the for loop, however, neither work.
Does anyone know what is wrong?
Thank you in Advance,
Adam