From 88921f0b917edde87a2d86d67214760a4042f575 Mon Sep 17 00:00:00 2001 From: scott snyder <snyder@bnl.gov> Date: Tue, 22 Dec 2020 01:28:02 +0100 Subject: [PATCH] MuonEventAthenaPool: Fix memory leak. In MdtCsmCnv_p1::persToTrans, we initialize the transient object via assigment. But it is a DataVector, so the assignment will leave it as a view container, meaning that its contents will be leaked. Need to convert it back to an owning container before populating it. --- .../MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx index 9696c744307..52139bb24cb 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx +++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MdtCsmCnv_p1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonRDO/MdtCsm.h" @@ -15,6 +15,10 @@ MdtCsmCnv_p1::persToTrans(const MdtCsm_p1* persColl, MdtCsm* transColl, MsgStrea persColl->m_SubDetId, persColl->m_MrodId, persColl->m_CsmId); + // The assignment above will leave *transColl as a view container. + // But it should own it's elements, so convert it back + // to an owning container. + transColl->clear (SG::OWN_ELEMENTS); // Invoke vector converter from the base template MdtCsm_Cnvp1_base_t::persToTrans( persColl, transColl, log ); -- GitLab