Re: TPad::DrawFrame() ... memory leakage

From: Rene Brun (Rene.Brun@cern.ch)
Date: Mon Jun 01 1998 - 10:50:04 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET