> It is likely that your TPhSpecTrack class has a custom Streamer. In this > case, a TBranchObject is created to force a call to your custom Streamer. Oops, that is correct. I'd been looking at TPhTrack and TPhMCTrack, which don't have custom streamers. Thanks, now I understand why the different branch types were created. > The objects in the TObjArray should be deleted. You do not mention which > version you are using. My guess is that you are using 3.02/07 or older. > Could you try with 3.03/06? We are using 3.02/07, but we have patched in some fixes to TChain/TTree. In the source, TTree.h has v1.35 and TTree.cxx has v1.106. I'm not sure which root package this corresponds to, but I can try with an updated version. Can you tell me which class this problem was fixed in? > The new TBranchElement ignores SetAutoDelete. The system attempts to > reuse the existing object as much as possible with an automatic deletion > of the internal objects pointed by this object. If one of the internal > pointers point to a TObjArray that is the owner of its objects, the > objects in the TObjArray should be deleted (at least with 3.03/06). I thought TBranchObject tried to reuse the existing object as well (to avoid expensive new/delete calls). Is the difference that because TBranchElement handles the streamer, it can be assured (theoretically ;) ) that there will be no memory leaks or buffer overflows? I'm curious about the difference because I thought this was the intended behavior for everything in a tree. > > As a final note, if a use TTree::BranchOld() and call the > SetAutoDelete() > > flag, I have no memory leaks. > > Is the leak coming from the objects in the TObjArray? The objects in the TObjArray are hits. With my version of root, unless I have TBranchObject and SetAutoDelete(), the track with the custom streamer never deletes its hits, even though the TObjArray owns them.
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:58 MET