[ROOT] TChain memory leaks in 3.02/07

From: Burt Holzman (burt@bnl.gov)
Date: Wed Apr 03 2002 - 22:51:49 MEST


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