[ROOT] TTree deleting branch object even with SetAutoDelete(kFALSE) and SetCanDelete(kFALSE)

From: John Frankland (jdf1@club-internet.fr)
Date: Sun Oct 26 2003 - 23:22:16 MET


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