Skip to content

Fix Mismatched delete, Definitely lost from Valgrind

Running

valgrind --tool=memcheck --leak-check=full --suppressions=../valgrind-root-fixed.supp --error-limit=no --track-origins=yes --smc-check=all --trace-children=yes  --track-fds=yes --num-callers=30  EgEfficiencyCorr_testEgEfficiencyCorr  $ASG_TEST_FILE_MC  5 > valgrind.log 2>&1 & 

one could see

Mismatched free() / delete / delete []
==3582542==    at 0x4A06016: operator delete(void*) (vg_replace_malloc.c:480)
==3582542==    by 0x54E9C22: std::default_delete<char>::operator()(char*) const (unique_ptr.h:76)
==3582542==    by 0x54E40CF: std::unique_ptr<char, std::default_delete<char> >::~unique_ptr() (unique_ptr.h:236)
==3582542==    by 0x54D29E7: Root::TElectronEfficiencyCorrectionTool::getHistograms() (TElectronEfficiencyCorrectionTool.cxx:657)
==3582542==    by 0x54BA395: Root::TElectronEfficiencyCorrectionTool::initialize() (TElectronEfficiencyCorrectionTool.cxx:161)
==3582542==    by 0x541B617: AsgElectronEfficiencyCorrectionTool::initialize() (AsgElectronEfficiencyCorrectionTool.cxx:218)
==3582542==    by 0x415EB2: main (testEgEfficiencyCorr.cxx:62)
==3582542==  Address 0x9be78d0 is 0 bytes inside a block of size 172 alloc'd
==3582542==    at 0x4A07192: operator new[](unsigned long) (vg_replace_malloc.c:363)
==3582542==    by 0x4E4FA46: StrDup(char const*) (in /cvmfs/atlas-nightlies.cern.ch/repo/sw/21.2/2019-01-14T0329/AnalysisBaseExternals/21.2.60/InstallArea/x86_64-slc6-gcc62-opt/lib/libCore.so)
==3582542==    by 0x4F27EDC: TUnixSystem::ExpandPathName(char const*) (in /cvmfs/atlas-nightlies.cern.ch/repo/sw/21.2/2019-01-14T0329/AnalysisBaseExternals/21.2.60/InstallArea/x86_64-slc6-gcc62-opt/lib/l\
ibCore.so)
==3582542==    by 0x54CF3A6: Root::TElectronEfficiencyCorrectionTool::getHistograms() (TElectronEfficiencyCorrectionTool.cxx:656)
==3582542==    by 0x54BA395: Root::TElectronEfficiencyCorrectionTool::initialize() (TElectronEfficiencyCorrectionTool.cxx:161)
==3582542==    by 0x541B617: AsgElectronEfficiencyCorrectionTool::initialize() (AsgElectronEfficiencyCorrectionTool.cxx:218)
==3582542==    by 0x415EB2: main (testEgEfficiencyCorr.cxx:62)

and

 1,088 (256 direct, 832 indirect) bytes in 4 blocks are definitely lost in loss record 26,231 of 30,417
==3627644==    at 0x4A075FC: operator new(unsigned long) (vg_replace_malloc.c:298)
==3627644==    by 0x4E57B38: TStorage::ObjectAlloc(unsigned long) (in /cvmfs/atlas-nightlies.cern.ch/repo/sw/21.2/2019-01-15T0331/AnalysisBaseExternals/21.2.60/InstallArea/x86_64-slc6-gcc62-opt/lib/libCo\
re.so)
==3627644==    by 0x4E5DA1A: TString::Tokenize(TString const&) const (in /cvmfs/atlas-nightlies.cern.ch/repo/sw/21.2/2019-01-15T0331/AnalysisBaseExternals/21.2.60/InstallArea/x86_64-slc6-gcc62-opt/lib/li\
bCore.so)
==3627644==    by 0x54F4DA3: Root::TElectronEfficiencyCorrectionTool::getHistograms() (TElectronEfficiencyCorrectionTool.cxx:670)
==3627644==    by 0x54DEC27: Root::TElectronEfficiencyCorrectionTool::initialize() (TElectronEfficiencyCorrectionTool.cxx:161)
==3627644==    by 0x543CCAD: AsgElectronEfficiencyCorrectionTool::initialize() (AsgElectronEfficiencyCorrectionTool.cxx:223)
==3627644==    by 0x40DA12: main (testEgEfficiencyCorr.cxx:62)

This fixes both.

Edited by Christos Anastopoulos

Merge request reports