TPad::DrawFrame() ... memory leakage

Valeriy Onuchin (onuchin@emcal06.rhic.bnl.gov)
Sun, 31 May 1998 15:35:44 -0400


Hello Rooters!

TPad::DrawFrame is used to force
an empty frame with the x and y axis drawn
(similar Null command in Paw).

In many cases I'd like to call it several times for
the same pad but calling

gPad->DrawFrame(xmin,ymin,xmax,ymax,title) several times
cause memory leakage because each time new TH1F is created
TH1F *hframe = new TH1F("hframe",title,100,xmin,xmax);

I think it would be better correct this by testing

if (!GetListOfPrimitives()->FindObject("hframe"))
TH1F *hframe = new TH1F("hframe",title,100,xmin,xmax);

With best regards , Valery