[ROOT] SegV in TTree::Fill when new objects occupy old addresses

From: Nick West (n.west1@physics.ox.ac.uk)
Date: Tue Nov 26 2002 - 15:29:19 MET


Hi,

I have recently been getting a SegV filling a TTree with a single TBranch
holding an object that has a data member that is a pointer to a
TClonesArray.  For each fill a new object is created and subsequently
deleted after filling. Looking with a debugger I could see that it was
always writing the correct object but that sometimes it was using an out of
date pointer to the TClonesArray.  Whenever this happened the new object had
been created at the same address as the object that had that pointer.
Perhaps the heap manager was refilling because it found a hole that exactly
fitted the object.  So it occurs to me that there is logic in TTree:Fill
that recognises an object by its address and saves time not traversing the
object structure updating addresses in the TBranchElements that represent
pointers to other objects.

So my questions are:-

1)  Is this supposition correct:  i.e. save time by not updating addresses
if the object address is unchanged?
2)  Is there a way to force the TTree to update addresses after recreating
the objects it writes?

I am using 3.03/08 on Linux RedHat 6.1 (Cartman) with gcc 2.91.

Thanks,

Nick West



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:21 MET