Skip to content
Snippets Groups Projects
Commit ffb2d2d3 authored by Gerhard Raven's avatar Gerhard Raven
Browse files

Improve memory management in ParticlePropertySvc

* replace `std::set<std::unique_ptr<ParticleProperty>>` with
  `std::deque<ParticleProperty>` to keep owned, stable (as
  in 'remains at the same memory location') properties
parent 3f9b70e4
No related branches found
No related tags found
1 merge request!1040Improve memory management in ParticlePropertySvc
Pipeline #1390813 passed
......@@ -134,10 +134,8 @@ namespace Gaudi {
double mass, double tlife, const std::string& evtName, int pythiaId,
double maxWidth ) {
//
auto i = m_owned.insert( std::make_unique<ParticleProperty>( particle, geantId, jetsetId, charge, mass, tlife,
evtName, pythiaId, maxWidth ) );
//
return i.second ? push_back( i.first->get() ) : StatusCode::FAILURE;
auto& pp = m_owned.emplace_back( particle, geantId, jetsetId, charge, mass, tlife, evtName, pythiaId, maxWidth );
return push_back( &pp );
}
// =============================================================================
/// Add a particle property.
......
......@@ -15,6 +15,7 @@
// ============================================================================
// STD&STL
// ============================================================================
#include <deque>
#include <map>
#include <set>
// ============================================================================
......@@ -180,8 +181,8 @@ namespace Gaudi {
MapPythiaID m_pythiaidmap; ///< Map for Pythia Ids
// local storage of ALL properties
std::set<std::unique_ptr<ParticleProperty>> m_owned;
std::set<std::string> m_replaced;
std::deque<ParticleProperty> m_owned;
std::set<std::string> m_replaced;
SmartIF<IFileAccess> m_fileAccess;
};
......
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