Deleting TObjArray

From: Chiara Zampolli <Chiara.Zampolli_at_bo.infn.it>
Date: Mon, 22 Oct 2007 17:50:15 +0200


Dear rooters,

    I have a doubt on how to delete a TObjArray and all its elements. What I am doing is:

TObjArray *fCal = new TObjArray(10);
fCal->SetOwner();
for (Int_t ich = 0; ich<10; ich ++){

    AliTOFChannelOnline * calChOnline = new AliTOFChannelOnline();     fCal->AddAt(calChOnline,ich);
}
fCal->Clear();
delete fCal;
fCal=0x0;

Is this the correct way to delete the TObjArray and all its elements? I thought yes, also from the ROOT user's guide. In fact, I still have some doubts, because if I do this, and then print the address of calChOnline, this is not null, and since there are some crashes while running a macro which uses this new/delete schema, I was wondering whether the problem could be here...

Thanks for your help.
Cheers,

    Chiara Received on Mon Oct 22 2007 - 17:45:01 CEST

This archive was generated by hypermail 2.2.0 : Mon Oct 22 2007 - 23:50:02 CEST