]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Fixing memory leak introduced with rev. 45388
authorivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Jan 2011 17:11:28 +0000 (17:11 +0000)
committerivana <ivana@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Jan 2011 17:11:28 +0000 (17:11 +0000)
(Philippe P.)

MUON/AliMUONPreClusterFinder.cxx
MUON/AliMUONPreClusterFinderV2.cxx
MUON/AliMUONPreClusterFinderV3.cxx
MUON/AliMUONSimpleClusterServer.cxx
MUON/AlirootRun_MUONtest.sh

index 1badcb0be30abfa8118a1bcefa97155cf7cc6b0f..cbbadf62bb901259bc1f006a37d5be161141b49e 100644 (file)
@@ -116,27 +116,28 @@ AliMUONPreClusterFinder::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
     return;
   }
   
-  cluster.AddPad(*pad);
+  AliMUONPad* addedPad = cluster.AddPad(*pad);
   
   Int_t cathode = pad->Cathode();
   TObjArray& padArray = *fPads[cathode];
   // WARNING: this Remove method uses the AliMUONPad::IsEqual if that method is
   // present (otherwise just compares pointers) : so that one must be correct
   // if implemented !
-  padArray.Remove(pad);
- // TObject* o = padArray.Remove(pad); 
+  TObject* o = padArray.Remove(pad);
 //  if (!o)
 //  {
 //    AliFatal("Oups. Could not remove pad from pads to consider. Aborting as anyway "
 //             " we'll get an infinite loop. Please check the AliMUONPad::IsEqual method"
 //             " as the first suspect for failed remove");
 //  }  
+  delete o;
+  
   TIter next(&padArray);
   AliMUONPad* testPad;
 
   while ( ( testPad = static_cast<AliMUONPad*>(next())))
   {
-    if ( AliMUONPad::AreNeighbours(*testPad,*pad) )
+    if ( AliMUONPad::AreNeighbours(*testPad,*addedPad) )
     {
       AddPad(cluster,testPad);
     }
index 46860317328df2ee9c5b108aba03aa0e51aeb8d0..e3d42f48bd974bf7dee0498f998f3bb7435dd780 100644 (file)
@@ -111,18 +111,16 @@ AliMUONPreClusterFinderV2::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
 {
   /// Add a pad to a cluster
   
-  cluster.AddPad(*pad);
-  pad->SetClusterId(cluster.GetUniqueID());
+  AliMUONPad* addedPad = cluster.AddPad(*pad);
   
   Int_t cathode = pad->Cathode();
   TObjArray& padArray = *fPads[cathode];
-  padArray.Remove(pad);
-  TIter next(&padArray);
+  delete padArray.Remove(pad);
   
   // Check neighbours
   TObjArray neighbours;
-  AliMpPad p = fkSegmentations[pad->Cathode()]->PadByIndices(pad->Ix(),pad->Iy(),kTRUE);
-  Int_t nn = fkSegmentations[pad->Cathode()]->GetNeighbours(p,neighbours);
+  AliMpPad p = fkSegmentations[cathode]->PadByIndices(addedPad->Ix(),addedPad->Iy(),kTRUE);
+  Int_t nn = fkSegmentations[cathode]->GetNeighbours(p,neighbours);
   for (Int_t in = 0; in < nn; ++in) 
   {
     AliMpPad* p1 = static_cast<AliMpPad*>(neighbours.At(in));
@@ -134,7 +132,7 @@ AliMUONPreClusterFinderV2::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
     {
         if ( !p2->IsUsed() && p2->Ix()==p1->GetIx() 
              && p2->Iy() == p1->GetIy() &&
-             p2->Cathode() == pad->Cathode() )
+             p2->Cathode() == cathode )
         {
           AddPad(cluster,p2);
         }
index 6f438b6ff64cef527934b278c9dbed1acc549366..f3a19e4744d26aca274312c4b992da1fd8796830 100644 (file)
@@ -232,7 +232,8 @@ AliMUONPreClusterFinderV3::AddPad(AliMUONCluster& cluster, AliMUONPad* pad)
   
   Int_t cathode = pad->Cathode();
   TObjArray& padArray = *fPads[cathode];
-  padArray.Remove(pad);
+  delete padArray.Remove(pad);
+  
   TIter next(&padArray);
   AliMUONPad* testPad;
   
index 01c5d177972daa38db84b87b01ff1551925a5d75..b0f37fe13d6e323b11e913e8730f2612ce8cadb1 100644 (file)
@@ -353,6 +353,7 @@ AliMUONSimpleClusterServer::UseDigits(TIter& next, AliMUONVDigitStore* digitStor
     if (!padArray)
     {
       padArray = new TObjArray(100);
+      padArray->SetOwner(kTRUE);
       fPads[cathode]->Add(detElemId,padArray);
     }
     
index 9aa2cc7ed63d16c47043a5671d3a3770e7b25c58..7d181d5a8f2318602cffbe3fffd953f57848719d 100755 (executable)
@@ -8,7 +8,7 @@ RECONSTRUCTION=1 # will perform reconstruction
 RAW=1 # will reconstruct from raw data
 CHECKS=1 # will perform checks
 SLASHTMP=1 #will use /tmp to put the temporary raw data 
-NEVENTS=100 # will simulate 100 events
+NEVENTS=50 # will simulate 100 events
 
 #RECOPTIONS="SAVEDIGITS NOFASTDECODERS" # reconstruction options with non-high performance decoders
 RECOPTIONS="SAVEDIGITS" # default reconstruction options