Re: TPad::DrawFrame() ... memory leakage
Rene Brun (Rene.Brun@cern.ch)
Mon, 01 Jun 1998 10:50:04 +0200
Valeriy Onuchin wrote:
>
> 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
Valery,
TPad::DrawFrame is supposed to be called once per pad.
Why do you want to call this function several times and not
clear the pad ?
I will add the protection anyhow. Thanks for the remark.
Rene Brun