Skip to content
Snippets Groups Projects
Commit 0125803d authored by scott snyder's avatar scott snyder
Browse files

JetRec: Fix memory leak.

PseudoJetContainer needs to delete the objects in m_emptyExtractors.
parent b9778595
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#define PseudoJetContainer_H #define PseudoJetContainer_H
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
...@@ -55,6 +55,8 @@ public: ...@@ -55,6 +55,8 @@ public:
const std::vector<PseudoJet> & vecPJ, const std::vector<PseudoJet> & vecPJ,
bool debug=false); bool debug=false);
~PseudoJetContainer();
// fill xAOD jet with constit&ghosts extracted from final PSeudoJet // fill xAOD jet with constit&ghosts extracted from final PSeudoJet
bool extractConstituents(xAOD::Jet&, const std::vector<PseudoJet>&) const; bool extractConstituents(xAOD::Jet&, const std::vector<PseudoJet>&) const;
bool extractConstituents(xAOD::Jet& jet, const PseudoJet &finalPJ) const; bool extractConstituents(xAOD::Jet& jet, const PseudoJet &finalPJ) const;
......
/* /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
// PseudoJetContainer.cxx // PseudoJetContainer.cxx
...@@ -44,6 +44,14 @@ PseudoJetContainer::PseudoJetContainer(const IConstituentExtractor* c, ...@@ -44,6 +44,14 @@ PseudoJetContainer::PseudoJetContainer(const IConstituentExtractor* c,
} }
PseudoJetContainer::~PseudoJetContainer()
{
for (const IConstituentExtractor* e : m_emptyExtractors) {
delete e;
}
}
bool bool
PseudoJetContainer::extractConstituents(xAOD::Jet& jet, PseudoJetContainer::extractConstituents(xAOD::Jet& jet,
const std::vector<PseudoJet>& inConstits) const const std::vector<PseudoJet>& inConstits) const
...@@ -137,7 +145,7 @@ void PseudoJetContainer::append(const PseudoJetContainer* other) { ...@@ -137,7 +145,7 @@ void PseudoJetContainer::append(const PseudoJetContainer* other) {
pj.set_user_index(pj.user_index() + offset);return pj;} pj.set_user_index(pj.user_index() + offset);return pj;}
); );
for(auto e : other->m_emptyExtractors){m_emptyExtractors.insert(e);} for(auto e : other->m_emptyExtractors){m_emptyExtractors.insert(e->clone());}
if (m_debug){checkInvariants("append()");} if (m_debug){checkInvariants("append()");}
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment