Re: [ROOT] TChain memory leaks in 3.02/07

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Apr 04 2002 - 09:11:36 MEST


Hi Burt,

Thanks for reporting this special case when branches are disabled.
Now fixed in CVS.

Rene Brun

Burt Holzman wrote:
> 
> Fellow ROOTers,
> 
> We're trying to read in multiple chains sequentially, limiting ourselves
> to read in certain branches of trees.  There seems to be a serious
> memory leak, as illustrated by the following code snippet:
> 
> {
>    for (int i=0; i < 1000; i++) {
>      TChain *t = new TChain("t1");
>      t->Add("tree1.root");
>      t->SetBranchStatus("*", 0);
>      t->GetEntry(0,0);
>      delete t;
>    }
> }
> 
> [tree1.root is created by $ROOTSYS/tutorials/tree1.C]
> 
> The culprit seems to be TBranchElement::GetEntry calling
> TBranchElement::SetAddress, which New()'s objects even though
> none of the branches have been activated, and does not delete
> them when the TChain is deleted.
> 
> - B



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET