Releasing memory used by TBranch

Hi, I have a code that is accessing many TBranch objects (more than 200) at the same time. I’d like to know how to ask to release the memory from some the TBranch objects once they are not needed. I cannot destroy the objects, I have tried with TBranch::DropBaskets() but ram usage doesn’t show a clear reduction in the memory usage. Is it expected?

Best, Guido

Hi Guido,

You would need to call branch->DropBaskets(“all”), this would delete the buffer and baskets for the branches but would not delete the user object associated with the branch. For that you would need something like:UserClass *ptr =0; tree->SetBranchAddress(branchname,&ptr); .... ....->GetEntry(...); ... delete ptr; ptr =0;Cheers,

Ok, I’ll take this in mind. I thought that because the TBranch is the owner of the memory of the user’s object a single DropBaskets could do both things. I’ll change my code.

Thanks, Guido