Hi John, It is my feeling that you are using a TClonesArray where you should use a TObjArray instead. In order to understand your problem, I would need a simplified version of your code reproducing the problem. But, I suggest first to check your destructors and look at the documentation of TClonesArray::Clear, option "C". Rene Brun John Frankland wrote: > > Hello > > I'm stuck. > I have a class "KVEvent" which has a TClonesArray member pointer. This > array is created in the > default constructor, and so has a "//->" comment in the header file. > Using the automatically > created Streamer it is necessary to add > TStreamerInfo::SetCanDelete(kFALSE) in the ctor so that > when reading back KVEvent objects from a TTree the same object is used > all the time, without > memory leaks (creating a TClonesArray every event). > I have a class "KVTestEvent" which inherits from KVEvent and poses no > particular problem. > I have another class "KVINDRAReconEvent" which inherits from KVEvent > also, but which, when > reading objects back from a TTree, systematically creates a new > KVINDRAReconEvent object > with each event read, and fills up the memory. This is despite the fact > that TStreamerInfo::SetCanDelete(kFALSE) > is present both in the KVINDRAReconEvent ctor and in that of KVEvent > and that I call > TBranch::SetAutoDelete(kFALSE) both when writing and reading the TTree. > I cannot understand > what is happening. The only clue I can perhaps give is that in the case > of KVINDRAReconEvent > the objects stored in the TClonesArray have a custom streamer and so I > use TClonesArray::BypassStreamer(kFALSE). > > Any assistance would be gratefully received. > > John
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET