Fixed memory leaks for #86360: High memory consumption in 2.76TeV p+p RAW reco jobs
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Sep 2011 18:02:04 +0000 (18:02 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 6 Sep 2011 18:02:04 +0000 (18:02 +0000)
12 files changed:
EMCAL/AliCaloRawAnalyzerFitter.cxx
EMCAL/AliEMCALRawUtils.cxx
EMCAL/AliEMCALReconstructor.cxx
ITS/AliITSV0Finder.cxx
ITS/AliITStrackerMI.cxx
PHOS/AliPHOSClusterizerv1.cxx
PHOS/AliPHOSDigit.cxx
PMD/AliPMDClusterFinder.cxx
STEER/STEER/AliDataLoader.cxx
T0/AliT0Reconstructor.cxx
TOF/AliTOFtracker.cxx
TPC/AliTPCclustererMI.cxx

index ef87806..e485f92 100644 (file)
@@ -52,7 +52,7 @@ AliCaloRawAnalyzerFitter::AliCaloRawAnalyzerFitter(const char *name, const char
 
 AliCaloRawAnalyzerFitter::~AliCaloRawAnalyzerFitter()
 {
-
+  delete fTf1;
 }
 
 
index 9bbd430..92cc806 100644 (file)
@@ -107,6 +107,8 @@ AliEMCALRawUtils::AliEMCALRawUtils( Algo::fitAlgorithm fitAlgo) : fNoiseThreshol
 AliEMCALRawUtils::~AliEMCALRawUtils() 
 {
   //dtor
+  delete fRawAnalyzer;
+  delete fTriggerRawDigitMaker;
 }
 
 
@@ -371,6 +373,7 @@ void AliEMCALRawUtils::TrimDigits(TClonesArray *digitsArr)
 
 void AliEMCALRawUtils::SetFittingAlgorithm(Int_t fitAlgo)              
 {
+  delete fRawAnalyzer; // delete doesn't do anything if the pointer is 0x0
   fRawAnalyzer = AliCaloRawAnalyzerFactory::CreateAnalyzer( fitAlgo );
   fRawAnalyzer->SetNsampleCut(5); // requirement for fits to be done, for the new methods
   fRawAnalyzer->SetOverflowCut ( OVERFLOWCUT );
index b3fba39..84c14a3 100644 (file)
@@ -308,7 +308,7 @@ void AliEMCALReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digits
     fgRawUtils->SetNoiseThreshold(GetRecParam()->GetNoiseThreshold());
     fgRawUtils->SetNPedSamples(GetRecParam()->GetNPedSamples());
     fgRawUtils->SetRemoveBadChannels(GetRecParam()->GetRemoveBadChannels());
-    fgRawUtils->SetFittingAlgorithm(GetRecParam()->GetFittingAlgorithm());
+    if (!fgRawUtils->GetFittingAlgorithm()) fgRawUtils->SetFittingAlgorithm(GetRecParam()->GetFittingAlgorithm());
     fgRawUtils->SetFALTROUsage(GetRecParam()->UseFALTRO());
     
     //fgRawUtils->SetTimeMin(GetRecParam()->GetTimeMin());
index 6420f8c..a9ca249 100644 (file)
@@ -1039,6 +1039,7 @@ void AliITSV0Finder::FindV02(AliESDEvent *event,
   delete[] itsmap;\r
   delete[] helixes;\r
   delete   pvertex;\r
+  delete   dummy;\r
 }\r
 //------------------------------------------------------------------------\r
 void AliITSV0Finder::RefitV02(const AliESDEvent *event,\r
index 0276c1c..f1484fb 100644 (file)
@@ -714,38 +714,34 @@ Int_t AliITStrackerMI::PropagateBack(AliESDEvent *event) {
 
      // Start time integral and add distance from current position to vertex 
      if (esd->GetStatus()&AliESDtrack::kITSout) continue;
-     AliITStrackMI *t = new AliITStrackMI(*esd);
+     AliITStrackMI t(*esd);
      Double_t xyzTrk[3],xyzVtx[3]={GetX(),GetY(),GetZ()};
-     t->GetXYZ(xyzTrk); 
+     t.GetXYZ(xyzTrk); 
      Double_t dst2 = 0.;
      for (Int_t icoord=0; icoord<3; icoord++) {Double_t di = xyzTrk[icoord] - xyzVtx[icoord];dst2 += di*di; } 
-     t->StartTimeIntegral();
-     t->AddTimeStep(TMath::Sqrt(dst2));
+     t.StartTimeIntegral();
+     t.AddTimeStep(TMath::Sqrt(dst2));
      //
      // transfer the time integral to ESD track
      esd->SetStatus(AliESDtrack::kTIME);
-     Double_t times[10];t->GetIntegratedTimes(times); esd->SetIntegratedTimes(times);
-     esd->SetIntegratedLength(t->GetIntegratedLength());
+     Double_t times[10];t.GetIntegratedTimes(times); esd->SetIntegratedTimes(times);
+     esd->SetIntegratedLength(t.GetIntegratedLength());
      //
-     if ((esd->GetStatus()&AliESDtrack::kITSin)==0) continue; 
+     if ((esd->GetStatus()&AliESDtrack::kITSin)==0) continue;
 
-     t->SetExpQ(TMath::Max(0.8*t->GetESDtrack()->GetTPCsignal(),30.));
-     ResetTrackToFollow(*t);
+     t.SetExpQ(TMath::Max(0.8*t.GetESDtrack()->GetTPCsignal(),30.));
+     ResetTrackToFollow(t);
      //
      fTrackToFollow.ResetCovariance(10.); fTrackToFollow.ResetClusters();
-     if (RefitAt(AliITSRecoParam::GetrInsideITSscreen(),&fTrackToFollow,t)) {
-       if (!CorrectForTPCtoITSDeadZoneMaterial(&fTrackToFollow)) {
-        delete t;
-        continue;
-       }
-       fTrackToFollow.SetLabel(t->GetLabel());
+     if (RefitAt(AliITSRecoParam::GetrInsideITSscreen(),&fTrackToFollow,&t)) {
+       if (!CorrectForTPCtoITSDeadZoneMaterial(&fTrackToFollow)) continue;
+       fTrackToFollow.SetLabel(t.GetLabel());
        //fTrackToFollow.CookdEdx();
        CookLabel(&fTrackToFollow,0.); //For comparison only
        fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout);
        //UseClusters(&fTrackToFollow);
        ntrk++;
      }
-     delete t;
   }
 
   AliInfo(Form("Number of back propagated ITS tracks: %d out of %d ESD tracks",ntrk,nentr));
index eb636a3..0862b40 100644 (file)
@@ -273,8 +273,8 @@ void AliPHOSClusterizerv1::Digits2Clusters(Option_t *option)
     AliInfo(Form("took %f seconds for Clusterizing\n",
                 gBenchmark->GetCpuTime("PHOSClusterizer"))); 
   }
-  fEMCRecPoints->Clear("C");
-  fCPVRecPoints->Clear("C");
+  fEMCRecPoints->Delete();
+  fCPVRecPoints->Delete();
 }
 
 //____________________________________________________________________________
index e86b5d5..4b40c61 100644 (file)
@@ -207,6 +207,7 @@ Int_t AliPHOSDigit::GetPrimary(Int_t index) const
 void AliPHOSDigit::SetALTROSamplesHG(Int_t nSamplesHG, Int_t *samplesHG)
 {
   fNSamplesHG = nSamplesHG;
+  if (fSamplesHG) delete [] fSamplesHG;
   fSamplesHG = new UShort_t[fNSamplesHG];
   UShort_t i;
   for (i=0; i<fNSamplesHG; i++) {
@@ -217,6 +218,7 @@ void AliPHOSDigit::SetALTROSamplesHG(Int_t nSamplesHG, Int_t *samplesHG)
 void AliPHOSDigit::SetALTROSamplesLG(Int_t nSamplesLG, Int_t *samplesLG)
 {
   fNSamplesLG = nSamplesLG;
+  if (fSamplesLG) delete [] fSamplesLG;
   fSamplesLG = new UShort_t[fNSamplesLG];
   UShort_t i;
   for (i=0; i<fNSamplesLG; i++) {
index de9a21b..4d9a77a 100644 (file)
@@ -269,9 +269,9 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
 
 
       // Int_t cluspar = fRecoParam->GetPbPbParam()->GetClusteringParam();
-
-      Int_t cluspar = fRecoParam->GetPPParam()->GetClusteringParam();
-      
+      AliPMDRecoParam * par = fRecoParam->GetPPParam();
+      Int_t cluspar = par->GetClusteringParam();
+      delete par;
 
       // Int_t cluspar = fRecoParam->GetCosmicParam()->GetClusteringParam();
       
@@ -597,7 +597,9 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
          Int_t imod = idet*24 + ismn;
 
          // Int_t cluspar = fRecoParam->GetPbPbParam()->GetClusteringParam();
-          Int_t cluspar = fRecoParam->GetPPParam()->GetClusteringParam();
+         AliPMDRecoParam * par = fRecoParam->GetPPParam();
+          Int_t cluspar = par->GetClusteringParam();
+          delete par;
          // Int_t cluspar = fRecoParam->GetCosmicParam()->GetClusteringParam();
 
          //_______________________________________________________// 
index 0e3c35f..9de8386 100644 (file)
@@ -437,6 +437,7 @@ void AliDataLoader::CloseFile()
   
   if (fFile) {
     fFile->Close("R");
+    delete fFile;
     fFile = 0x0;
   }
   fDirectory = 0x0;
index 32bac62..1ef056d 100644 (file)
@@ -691,6 +691,7 @@ void AliT0Reconstructor::Reconstruct(AliRawReader* rawReader, TTree*recTree) con
     pESD->SetTZEROData(fESDTZERO);
   }
 
+  if(frecpoints) delete frecpoints;
 
 } // vertex in 3 sigma
 
index abd2f26..a646040 100644 (file)
@@ -438,7 +438,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
   //The matching loop
   for (Int_t iseed=0; iseed<fNseedsTOF; iseed++) {
 
-    fTOFtrackPoints->Clear();
+    fTOFtrackPoints->Delete();
 
     for (Int_t ii=0; ii<kNclusterMax; ii++)
       global[ii] = 0x0;
index 82bb79a..95170c5 100644 (file)
@@ -258,8 +258,8 @@ void AliTPCclustererMI::SetOutput(TTree * tree)
   //
   if (!tree) return;
   fOutput= tree;
-  AliTPCClustersRow clrow, *pclrow=&clrow;  
-  pclrow = new AliTPCClustersRow("AliTPCclusterMI");
+  AliTPCClustersRow clrow("AliTPCclusterMI");
+  AliTPCClustersRow *pclrow=&clrow;  
   fOutput->Branch("Segment","AliTPCClustersRow",&pclrow,32000,200);    
 }