Hi rooters, I don't know if David Chamont's problem is related to the following, but this is what we found: In the win32 root v.3.02.00 version, the deletion of TObjArray owned objects does not seem to work correctly. The doc and the intent of the TObjArray::Delete() function is to delete all HEAP based objects and set fCont[i]=0 for all deleted objects and also for all STACK based objects; To do that, IMHO the fCont[i] needs to be outside the if(...IsOnHeap()) statement as suggested below: //__________________________________________________________________________ ____ void TObjArray::Delete(Option_t *) { // Remove all objects from the array AND delete all heap based objects. for (Int_t i = 0; i < fSize; i++) { if (fCont[i] && fCont[i]->IsOnHeap()) { TCollection::GarbageCollect(fCont[i]); //fCont[i] = 0; // tkp nlx 4/5/02 commented out intentionally } fCont[i] = 0; // tkp nlx 4/5/02 moved outside the loop to remove ALL objects } Init(fSize, fLowerBound); } HOWEVER, the real problem is that in CINT (on win32) the TObject::IsOnHeap() ALWAYS returns true both for heap and stack objects as demonstrated by the testmacro TObjArrayTest_roottalk.C calling TObjArray::Delete() in the attachment. CINT crashes if this macro is run twice (and can't recover). I did not test this on other platforms. Is it possible that TObject::IsOnHeap() does not work at all on Win32 platforms (or do I just not understand it's supposed purpose)? But then there is no way to safely delete mixed collections on windows?!? What to do? Thanks. Peter
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:49 MET