From 98e67b3335c60094a4e7fecfb80af3655ae6b10b Mon Sep 17 00:00:00 2001 From: lgraczyk Date: Fri, 31 May 2013 12:52:06 +0000 Subject: [PATCH] memory leak fixes in AliFemto code --- PWGCF/FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx | 4 ++-- .../FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.cxx | 12 +++++------- PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.h | 1 - .../FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx | 5 +++++ PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx | 13 ++++++++++++- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/PWGCF/FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx b/PWGCF/FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx index c12028bba41..9b42a213365 100644 --- a/PWGCF/FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx +++ b/PWGCF/FEMTOSCOPY/AliFemto/AliAnalysisTaskFemto.cxx @@ -50,7 +50,7 @@ AliAnalysisTaskSE(name), //AliAnalysisTask(name,""), { // Constructor. // Input slot #0 works with an Ntuple - DefineInput(0, TChain::Class()); + //DefineInput(0, TChain::Class()); // Output slot #0 writes into a TH1 container DefineOutput(0, TList::Class()); @@ -74,7 +74,7 @@ AliAnalysisTaskFemto::AliAnalysisTaskFemto(TString name, TString aConfigMacro="C { // Constructor. // Input slot #0 works with an Ntuple - DefineInput(0, TChain::Class()); + //DefineInput(0, TChain::Class()); // Output slot #0 writes into a TH1 container DefineOutput(0, TList::Class()); diff --git a/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.cxx b/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.cxx index 2213c324a9b..755f1ec21ab 100644 --- a/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.cxx +++ b/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.cxx @@ -56,8 +56,7 @@ AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(): fEstEventMult(kCentrality), fAODpidUtil(0), fAODheader(0), - fInputFile(" "), - fFileName(" "), + fInputFile(""), fTree(0x0), fAodFile(0x0), fMagFieldSign(1), @@ -87,8 +86,7 @@ AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(const AliFemtoEventReaderAOD &aRe fEstEventMult(kCentrality), fAODpidUtil(0), fAODheader(0), - fInputFile(" "), - fFileName(" "), + fInputFile(""), fTree(0x0), fAodFile(0x0), fMagFieldSign(1), @@ -99,7 +97,6 @@ AliFemtoEventReaderAOD::AliFemtoEventReaderAOD(const AliFemtoEventReaderAOD &aRe fReadMC = aReader.fReadMC; fReadV0 = aReader.fReadV0; fInputFile = aReader.fInputFile; - fFileName = aReader.fFileName; fNumberofEvent = aReader.fNumberofEvent; fCurEvent = aReader.fCurEvent; fEvent = new AliAODEvent(); @@ -138,7 +135,6 @@ AliFemtoEventReaderAOD& AliFemtoEventReaderAOD::operator=(const AliFemtoEventRea return *this; fInputFile = aReader.fInputFile; - fFileName = aReader.fFileName; fNumberofEvent = aReader.fNumberofEvent; fCurEvent = aReader.fCurEvent; if (fTree) delete fTree; @@ -893,7 +889,9 @@ void AliFemtoEventReaderAOD::CopyAODtoFemtoTrack(AliAODTrack *tAodTrack, tFemtoTrack->SetNominalTPCEntrancePoint(tpcEntrance); tFemtoTrack->SetNominalTPCPoints(tpcPositions); tFemtoTrack->SetNominalTPCExitPoint(tpcExit); - + for(int i=0;i<9;i++) + delete [] tpcPositions[i]; + delete [] tpcPositions; // } // // cout << "Track has " << TMath::Hypot(tAodTrack->Xv(), tAodTrack->Yv()) << " " << tAodTrack->Zv() << " " << tAodTrack->GetTPCNcls() << endl; diff --git a/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.h b/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.h index e88317c2eac..02391acccf3 100644 --- a/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.h +++ b/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoEventReaderAOD.h @@ -90,7 +90,6 @@ class AliFemtoEventReaderAOD : public AliFemtoEventReader AliAODMCParticle* GetParticleWithLabel(TClonesArray *mcP, Int_t aLabel); string fInputFile; // name of input file with AOD filenames - string fFileName; // name of current AOD file TChain* fTree; // AOD tree TFile* fAodFile; // AOD file int fMagFieldSign; // Magnetic field sign diff --git a/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx b/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx index 59097ee905d..f94572961e7 100644 --- a/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx +++ b/PWGCF/FEMTOSCOPY/AliFemto/AliFemtoSimpleAnalysis.cxx @@ -592,6 +592,7 @@ TList* AliFemtoSimpleAnalysis::GetOutputList() while (TObject *obj = nextp1.Next()) { tOutputList->Add(obj); } + delete p1Cut; if (fSecondParticleCut != fFirstParticleCut) { TList *p2Cut = fSecondParticleCut->GetOutputList(); @@ -600,6 +601,7 @@ TList* AliFemtoSimpleAnalysis::GetOutputList() while (TObject *obj = nextp2()) { tOutputList->Add(obj); } + delete p2Cut; } TList *pairCut = fPairCut->GetOutputList(); @@ -608,6 +610,7 @@ TList* AliFemtoSimpleAnalysis::GetOutputList() while (TObject *obj = nextpair()) { tOutputList->Add(obj); } + delete pairCut; TList *eventCut = fEventCut->GetOutputList(); @@ -615,6 +618,7 @@ TList* AliFemtoSimpleAnalysis::GetOutputList() while (TObject *obj = nextevent()) { tOutputList->Add(obj); } + delete eventCut; AliFemtoCorrFctnIterator iter; for (iter=fCorrFctnCollection->begin(); iter!=fCorrFctnCollection->end();iter++){ @@ -624,6 +628,7 @@ TList* AliFemtoSimpleAnalysis::GetOutputList() while (TObject *obj = nextListCf()) { tOutputList->Add(obj); } + delete tListCf; } return tOutputList; diff --git a/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx b/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx index a4cd836578a..add341453d7 100644 --- a/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx +++ b/PWGCF/FEMTOSCOPY/AliFemtoUser/AliFemtoYlm.cxx @@ -19,7 +19,11 @@ AliFemtoYlm::AliFemtoYlm() { InitializeYlms(); } -AliFemtoYlm::~AliFemtoYlm() {} +AliFemtoYlm::~AliFemtoYlm() { + free(fgPrefactors); + free(fgPrefshift); + free(fgPlmshift); +} AliFemtoYlm::AliFemtoYlm(const AliFemtoYlm& aYlm){ @@ -95,6 +99,13 @@ void AliFemtoYlm::InitializeYlms() double oneoversqrtpi = 1.0/TMath::Sqrt(TMath::Pi()); + if(fgPrefactors!=NULL) + free(fgPrefactors); + if(fgPrefshift!=NULL) + free(fgPrefshift); + if(fgPlmshift!=NULL) + free(fgPlmshift); + fgPrefactors = (double *) malloc(sizeof(double) * 36); fgPrefshift = (int *) malloc(sizeof(int) * 6); fgPlmshift = (int *) malloc(sizeof(int) * 6); -- 2.39.3