Skip to content

Avoid copy when classname is empty in AthContainers

The same logic as elsewhere in AuxTypeRegistry - avoid a copy if we're just returning the name.

Fixes this heaptrack report:

95680 temporary allocations of 95680 allocations in total (100.00%) from:
    void std::__cxx11::basic_string<>::_M_construct_aux<>(char*, char*, std::__false_type)
      at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/basic_string.h:255
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc11-opt/2023-01-24T2101/Athena/23.0.15/InstallArea/x86_64-centos7-gcc11-opt/lib/libAthContainers.so
    void std::__cxx11::basic_string<>::_M_construct<>(char*, char*)
      at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/basic_string.h:274
    std::__cxx11::basic_string<>::basic_string(std::__cxx11::basic_string<> const&)
      at /cvmfs/sft.cern.ch/lcg/releases/gcc/11.2.0-8a51a/x86_64-centos7/include/c++/11.2.0/bits/basic_string.h:459
    SG::AuxTypeRegistry::makeKey(std::__cxx11::basic_string<> const&, std::__cxx11::basic_string<> const&)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthContainers/Root/AuxTypeRegistry.cxx:145
    SG::AuxTypeRegistry::findAuxID(std::__cxx11::basic_string<> const&, std::__cxx11::basic_string<> const&, SG::AuxTypeRegistry::Flags, std::type_info const&, SG::IAuxTypeVectorFactory* (SG::AuxTypeRegistry::*)() const)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthContainers/Root/AuxTypeRegistry.cxx:468
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc11-opt/2023-01-24T2101/Athena/23.0.15/InstallArea/x86_64-centos7-gcc11-opt/lib/libAthContainers.so
    unsigned long SG::AuxTypeRegistry::getAuxID<>(std::__cxx11::basic_string<> const&, std::__cxx11::basic_string<> const&, SG::AuxTypeRegistry::Flags)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthContainers/AthContainers/AuxTypeRegistry.icc:31
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc11-opt/2023-01-24T2101/Athena/23.0.15/InstallArea/x86_64-cen
tos7-gcc11-opt/lib/libTrigOutputHandlingLib.so
    SG::ConstAuxElement::Decorator<>::Decorator(std::__cxx11::basic_string<> const&, std::__cxx11::basic_string<> const&, SG::AuxTypeRegistry::Flags)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthContainers/AthContainers/AuxElement.icc:629
    SG::ConstAuxElement::Decorator<>::Decorator(std::__cxx11::basic_string<> const&)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthContainers/AthContainers/AuxElement.icc:595
    SG::AuxElement::Decorator<>::Decorator(std::__cxx11::basic_string<> const&)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/AthContainers/AthContainers/AuxElement.h:1105
    SG::WriteDecorHandle<>::WriteDecorHandle(SG::WriteDecorHandleKey<> const&)
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Control/StoreGate/StoreGate/WriteDecorHandle.icc:29
    HLTEDMCreator::fixLinks() const
      at /build/atnight/localbuilds/nightlies/Athena/master/athena/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.cxx:247
      in /cvmfs/atlas-nightlies.cern.ch/repo/sw/master_Athena_x86_64-centos7-gcc11-opt/2023-01-24T2101/Athena/23.0.15/InstallArea/x86_64-centos7-gcc11-opt/lib/libTrigOutputHandlingLib.so

Cheers,

Stewart

Merge request reports

Loading