Re: [ROOT] Memory leak or desired behavior?

From: Rene Brun (Rene.Brun@cern.ch)
Date: Sat Sep 29 2001 - 18:05:45 MEST


Hi Glen,

I have fixed the problem in the CVS version.
When the option "goff" is used, I now keep the generated histogram "htemp"
in the current directory. It is automatically deleted at the next Draw
call.
Thanks for reporting the problem.

Rene Brun

On Sat, 29 Sep 2001, Glen R. Salo wrote:

> Hi Rene,
> 
> I'm sorry, but I don't quite understand.  Try the following
> 
> TFile f("Event.root");
> TTree *t = (TTree *)f.Get("T");
> 
> gObjectTable->Print() indicates there are no TH1F's and TAxis's.
> 
> Now do
> 
> for (Int_t i=0; i<1000; i++) t->Draw("fNtrack");
> 
> gObjectTable->Print() indicates there are 2 TH1F and 6 TAxis.  If I
> delete the TCanvas, gObjectTable->Print() shows there are 1 TH1F and 3
> TAxis.  
> 
> Now type:
> 
> for (Int_t i=0; i<1000; i++) t->Draw("fNtrack","","goff");
> 
> and gObjectTable->Print() shows there are 1001 TH1F and 3003 TAxis.
> 
> if I type:
> 
> delete t; 
> f.Close();
> 
> 
> gObjectTable->Print() still shows 1001 TH1F and 3003 TAxis.  
> 
> I don't think that is correct.  If it is, please let me know how to get
> rid of the TH1F's and TAxis's.
> 
> Thanks for all of your help.  The support for ROOT has been outstanding.
> 
> Glen
> 
> 
> On 29-Sep-2001 Rene Brun wrote:
> > Hi Glen,
> > 
> > This is hopefully the expected behaviour. You should delete t
> > in your loop.
> > 
> > Rene Brun
> > 
> > On Fri, 28 Sep 2001, Glen R. Salo wrote:
> > 
> >> The following snip of code creates 1001 TH1F's and 3003 TAxis's on the
> >> heap.  I did not expect this behavior?  Am I doing something wrong?
> >> 
> >> TFile f("Event.root")
> >> TTree *t = (TTree *)f.Get("T")
> >> for (Int_t i=0; i<1000; i++) t->Draw("fNtrack","","goff");
> >> gObjectTable->Print();
> >> 
> >> I am running the latest CVS on a RedHat 7.1 PC.
> >> 
> >> Thanks,
> >> 
> >> Glen
> >> 
> 
> 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:01 MET