[ROOT] object deletion

From: Thomas Schoerner (schorner@mail.desy.de)
Date: Wed Jun 18 2003 - 23:11:04 MEST


Hello,

a probably very simple question:

Assume that in ProcessCut I create objects on the heap and have a cut
which is not always fulfilled:

Bool_t AnaJet::ProcessCut(Int_t entry)
{
  m_AnaJet_Particles_Lab = new TObjArray;
...
...
  if(somecondition) return kFALSE;
...
...
  return kTRUE;
}

If I manage to get to ProcessFill, I can delete the object and have no
problem:

void AnaJet::ProcessFill(Int_t entry)
{
...
  delete m_AnaJet_Particles_Lab;
...
}

BUt what if somecondition is not fulfilled and I do not get to
ProcessFill? How can I efficienctly delete the object so that only the
pointer remains and I can reallocate memory during the next event?

Cheers,

Thomas



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