From 29de80ada7e40395ece12b2a153121b0fb035b5d Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@mpcdf.mpg.de>
Date: Wed, 16 Dec 2020 13:51:51 +0100
Subject: [PATCH] tries to be smarter about memory

---
 cpp/particles/p2p/p2p_ghost_collisions.hpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpp/particles/p2p/p2p_ghost_collisions.hpp b/cpp/particles/p2p/p2p_ghost_collisions.hpp
index b609d17f..d6ddae34 100644
--- a/cpp/particles/p2p/p2p_ghost_collisions.hpp
+++ b/cpp/particles/p2p/p2p_ghost_collisions.hpp
@@ -87,6 +87,7 @@ public:
         this->disk_width = src.disk_width;
         this->isActive = src.isActive;
         this->synchronisation = src.synchronisation;
+        this->collision_pairs_local.reserve(src.collision_pairs_local.capacity());
     }
 
     template <int size_particle_rhs>
@@ -178,8 +179,8 @@ public:
 
 
     void reset_collision_pairs(){
-        this->collision_pairs_local.clear();
-        this->collision_pairs_global.clear();
+        this->collision_pairs_local.resize(0);
+        this->collision_pairs_global.resize(0);
         this->synchronisation = false;
     }
 
-- 
GitLab