Skip to content

Commit

Permalink
fix for memory leak in VZERO (C.Mayer)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahor02 authored and dberzano committed Nov 21, 2016
1 parent 2c80dc7 commit 1c0c0bb
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions VZERO/VZEROsim/AliVZERODigitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ void AliVZERODigitizer::Digitize(Option_t* /*option*/)
{
// Creates digits from hits
fNdigits = 0;

if (fVZERO && !fDigInput) {
AliLoader *loader = fVZERO->GetLoader();
if (!loader) {
Expand All @@ -251,15 +250,15 @@ void AliVZERODigitizer::Digitize(Option_t* /*option*/)
}
}
else if (fDigInput) {
ReadSDigits();
DigitizeSDigits();
AliRunLoader *currentLoader = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
AliLoader *loader = currentLoader->GetLoader("VZEROLoader");
if (!loader) {
AliError("Cannot get VZERO Loader via RunDigitizer!");
return;
}
WriteDigits(loader);
ReadSDigits();
DigitizeSDigits();
AliRunLoader *currentLoader = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
AliLoader *loader = currentLoader->GetLoader("VZEROLoader");
if (!loader) {
AliError("Cannot get VZERO Loader via RunDigitizer!");
return;
}
WriteDigits(loader);
}
else {
AliFatal("Invalid digitization task! Exiting!");
Expand Down Expand Up @@ -296,6 +295,9 @@ void AliVZERODigitizer::ResetDigits(Option_t* opt)

fNdigits = 0;
if (fDigits) fDigits->Clear(opt);
// CM
delete fDigits;
fDigits = NULL;
}

//____________________________________________________________________________
Expand Down Expand Up @@ -603,7 +605,6 @@ void AliVZERODigitizer::ReadSDigits()
AliError("Failed to get sdigit branch");
return;
}

// Set the branch address
TClonesArray *sdigitsArray = NULL;
sdigitsBranch->SetAddress(&sdigitsArray);
Expand Down Expand Up @@ -638,7 +639,9 @@ void AliVZERODigitizer::ReadSDigits()
}
}
}
sdigitsArray->Clear("C"); // CM
}
delete sdigitsArray; // CM
loader->UnloadSDigits();
}
}
Expand Down

0 comments on commit 1c0c0bb

Please sign in to comment.