Re: [ROOT] Problems with array->Delete()

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Oct 01 2003 - 13:56:51 MEST


Hi Thomas,

I do not understand how you can get a seg. fault in your TSelector Begin
if the only thing you do is
  m_Hadrons_Lab = new TObjArray;
  m_Hadrons_Labs->Delete();

The second statement being useleless, you have probably this statement somewhere
else.
Could you clarify your mail? if possible, sending a real piece of code that we
can test ourselves?

Which version of Root are uou using?

Rene Brun

Thomas Schoerner wrote:
> 
> Dear rooters,
> 
> I am running into the following problem. I have an TObjArray (of
> TLorentzVectors) which I initialise in the Begin method:
> 
>     m_Hadrons_Lab = new TObjArray;
> 
> in ProcessCut I delete, for safety
> 
>     m_Hadrons_Lab->Delete();
> 
> and fill
> 
>       for( ... some loop ... )
>       {
>           m_Hadrons_Lab->Add(new
>              TLorentzVector(p1,p2,p3,p4);
>       }
> 
> I perform further operations on this array in processFill and ProcessCut
> (looping, printing etc.), ut nothing serious.
> 
> In Terminate, I finally delete:
> 
>   m_Hadrons_Lab->Delete();
>   delete m_Hadrons_Lab;
> 
> Since some time I get a seg fault in the Begin method where I try to do
> the ->Delete() ... Studying the array directly before the Delete() command
> shows that it is 'healthy' and contains the elements given to it in the
> previous ProcesFill call ...
> 
> Can anybody tell me what is going on here ?
> 
> Cheers, and thanks,
> 
> Thomas
> 
>    +-------------------------------------------------------------------+
>    |  Thomas Schoerner-Sadenius          schorner@mail.desy.de         |
>    |  Universitaet Hamburg, Institut fuer Experimentalphysik           |
>    |  Luruper Chaussee 149               phone 0049-40-8998-2954       |
>    |  D-22761 Hamburg                    room  67b / 5                 |
>    +-------------------------------------------------------------------+



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:15 MET