Skip to content

LumiBlockComps: Fix memory leak in CreateLumiBlockCollectionFromFile::fillLumiBlockCollection()

I came across minor leaks from CreateLumiBlockCollectionFromFile::fillLumiBlockCollection() while going over the valgrind report, e.g.:

29,976 (264 direct, 29,712 indirect) bytes in 1 blocks are definitely lost in loss record 93,928 of 95,546
  at 0x4C2AA02: operator new(unsigned long) (vg_replace_malloc.c:344)
  by 0x7EEF42BE: CreateLumiBlockCollectionFromFile::fillLumiBlockCollection() (in libLumiBlockCompsLib.so)
  by 0x7EEF5AC1: CreateLumiBlockCollectionFromFile::handle(Incident const&) (in libLumiBlockCompsLib.so)
  by 0x3C710EE4: IncidentSvc::i_fireIncident(Incident const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (in libGaudiCoreSvc.so)
  by 0x3C711289: IncidentSvc::fireIncident(Incident const&) (in libGaudiCoreSvc.so)
  by 0x3FF820E5: MetaDataSvc::stop() (in libAthenaServices.so)
  by 0x28B78D28: Service::sysStop() (in libGaudiKernel.so)
  by 0x3C6AF172: ServiceManager::stop() (in libGaudiCoreSvc.so)
  by 0x3C680898: ApplicationMgr::stop() (in libGaudiCoreSvc.so)

When the containers that are created in this method are recorded in the meta-data store, it takes ownership and cleans things up properly. But, if that doesn't happen then we leak the containers. I simply converted the raw pointers to unique pointers to avoid that.

-s

Merge request reports