Skip to content

better memory management in Geo2G4Svc

Miha Muskinja requested to merge mmuskinj/athena:21.0-Geo2G4-memory into 21.0

Aims to address a memory leak spotted by valgrind:

==178886== 954,008 (18,616 direct, 935,392 indirect) bytes in 179 blocks are definitely lost in loss record 55,963 of 56,023
==178886== at 0x4C2808C: operator new(unsigned long) (vg_replace_malloc.c:333)
==178886== by 0x2FB56303: Geo2G4AssemblyFactory::Build(GeoPVConstLink, bool&) const (in /cvmfs/atlas-nightlies.cern.ch/repo/sw/21.0/2019-03-18T2158/Athena/21.0.95/InstallArea/x86_64-slc6-gcc62-opt/lib/libGeo2G4Lib.so)

Removes static initializations of AssemblyFactory and further static map in Geo2G4AssemblyFactory.cxx.

An AssemblyFactory is now a member object of Geo2G4Svc. Some functions could no longer be const because Geo2G4AssemblyFactory::Build modifies the member map. Before this was possible because the map was not a member object but rather a static object.

Edited by Miha Muskinja

Merge request reports