Skip to content

Commit 7317463

Browse files
committed
fix for memory leak in VZERO (C.Mayer)
1 parent ae7c5b8 commit 7317463

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

VZERO/VZEROsim/AliVZERODigitizer.cxx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ void AliVZERODigitizer::Digitize(Option_t* /*option*/)
229229
{
230230
// Creates digits from hits
231231
fNdigits = 0;
232-
233232
if (fVZERO && !fDigInput) {
234233
AliLoader *loader = fVZERO->GetLoader();
235234
if (!loader) {
@@ -251,15 +250,15 @@ void AliVZERODigitizer::Digitize(Option_t* /*option*/)
251250
}
252251
}
253252
else if (fDigInput) {
254-
ReadSDigits();
255-
DigitizeSDigits();
256-
AliRunLoader *currentLoader = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
257-
AliLoader *loader = currentLoader->GetLoader("VZEROLoader");
258-
if (!loader) {
259-
AliError("Cannot get VZERO Loader via RunDigitizer!");
260-
return;
261-
}
262-
WriteDigits(loader);
253+
ReadSDigits();
254+
DigitizeSDigits();
255+
AliRunLoader *currentLoader = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
256+
AliLoader *loader = currentLoader->GetLoader("VZEROLoader");
257+
if (!loader) {
258+
AliError("Cannot get VZERO Loader via RunDigitizer!");
259+
return;
260+
}
261+
WriteDigits(loader);
263262
}
264263
else {
265264
AliFatal("Invalid digitization task! Exiting!");
@@ -296,6 +295,9 @@ void AliVZERODigitizer::ResetDigits(Option_t* opt)
296295

297296
fNdigits = 0;
298297
if (fDigits) fDigits->Clear(opt);
298+
// CM
299+
delete fDigits;
300+
fDigits = NULL;
299301
}
300302

301303
//____________________________________________________________________________
@@ -603,7 +605,6 @@ void AliVZERODigitizer::ReadSDigits()
603605
AliError("Failed to get sdigit branch");
604606
return;
605607
}
606-
607608
// Set the branch address
608609
TClonesArray *sdigitsArray = NULL;
609610
sdigitsBranch->SetAddress(&sdigitsArray);
@@ -638,7 +639,9 @@ void AliVZERODigitizer::ReadSDigits()
638639
}
639640
}
640641
}
642+
sdigitsArray->Clear("C"); // CM
641643
}
644+
delete sdigitsArray; // CM
642645
loader->UnloadSDigits();
643646
}
644647
}

0 commit comments

Comments
 (0)