Skip to content

MassConstrainedVeloTrack leaks memory

Cloned vertices are leaked because new Particles do not own them. The solution should be to put newly created end vertices on the TES alongside the Particles output. The size of the leak (~1000 bytes/event) is in the right ballpark to explain the current leak in HLT2. The persistency of the new particles might be affected (if persisted at all).

/cc @msaur

==1246182==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 30915040 byte(s) in 148630 object(s) allocated from:
    #0 0x7fd5feed9b88 in operator new(unsigned long) (/cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/13.1.0-b3d18/x86_64-el9/lib64/libasan.so+0xd9b88) (BuildId: d6807ebfc45a24e8b959fbb3ea7d9763225b44b4)
    #1 0x7fd55f4e80a9 in LHCb::Vertex::clone() const stack/LHCb/Event/PhysEvent/include/Event/Vertex.h:100
    #2 0x7fd42dd9a7b9 in MassConstrainedVeloTrack::operator()(Gaudi::NamedRange_<std::vector<LHCb::Particle const*, std::allocator<LHCb::Particle const*> >, __gnu_cxx::__normal_iterator<LHCb::Particle const* const*, std::vector<LHCb::Particle const*, std::allocator<LHCb::Particle const*> > > > const&, LHCb::Detector::DeIOVElement<LHCb::Detector::detail::DeIOVObject> const&) const stack/Rec/Phys/ParticleMatching/src/MassConstrainedVeloTrack.cpp:80

...

Direct leak of 9284496 byte(s) in 44637 object(s) allocated from:
    #0 0x7fd5feed9b88 in operator new(unsigned long) (/cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/13.1.0-b3d18/x86_64-el9/lib64/libasan.so+0xd9b88) (BuildId: d6807ebfc45a24e8b959fbb3ea7d9763225b44b4)
    #1 0x7fd55f4e80a9 in LHCb::Vertex::clone() const stack/LHCb/Event/PhysEvent/include/Event/Vertex.h:100
    #2 0x7fd42dd9aa89 in MassConstrainedVeloTrack::operator()(Gaudi::NamedRange_<std::vector<LHCb::Particle const*, std::allocator<LHCb::Particle const*> >, __gnu_cxx::__normal_iterator<LHCb::Particle const* const*, std::vector<LHCb::Particle const*, std::allocator<LHCb::Particle const*> > > > const&, LHCb::Detector::DeIOVElement<LHCb::Detector::detail::DeIOVObject> const&) const stack/Rec/Phys/ParticleMatching/src/MassConstrainedVeloTrack.cpp:81 
Edited by Rosen Matev