Is the memory leak in TTree->GetEvent(entry)?

From: <ywl_at_hep.pku.edu.cn>
Date: Fri, 15 Apr 2005 20:14:56 +0800 (CST)


Dear rooters,

When I performed data analysis,I created a class(named Burst) to store the data in root files using the following style:

"f = new TFile("test.root",RECREATE);

t = new TTree("t","A Tree with Bursts"); burst = new Burst();
t->Branch("uDST","Burst",&burst,160000,2);"

There is no problem in the process of storing,but when I used the stored data to analysis I met the trouble,the process of opening the files:

"TFile *fin = new TFile("test.root");

TTree *T = (TTree*)fin->Get("t");
Burst *burst = new Burst();
TBranch *TESTuDST = T->GetBranch("uDST"); TESTuDST->SetAddress(&burst);
Int_t TotBursts = T->GetEntries();
for(Int_t i=0;i<TotBursts;i++){

    T->GetEvent(i); ...................(memory leak)
    ..............
    ..............
    burst->Clear();
}
delete burst;
delete T;
fin->Close();"

I found there is very big memory oocupied when using the operation T->GetEvent(i) in the loop which did not be cleared at the end of the loop. I didn't find the suitable member function in class TTree to deal with this problem. As I want to analysize more than one files every time, the programme always breaked because of the memory exhausted. Could you like to help me solve this problem?

Best regards,
Weilin Received on Fri Apr 15 2005 - 13:07:43 MEST

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:06 MET