From 2295be781dff171591f11069d017f79ecd1a2edf Mon Sep 17 00:00:00 2001 From: graham Date: Mon, 7 Sep 2009 18:00:14 +0100 Subject: [PATCH] Fixing memory leak when referring particles. --- .../InteractionLists/ReferredCellList/ReferredCellList.C | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C index fc18a84a97..36f6f461e4 100644 --- a/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C +++ b/src/lagrangian/basic/InteractionLists/ReferredCellList/ReferredCellList.C @@ -1592,10 +1592,10 @@ void Foam::ReferredCellList::storeParticles ); } - particlesToReferIn.remove(&p); - particleI++; } + + particlesToReferIn.clear(); } @@ -1702,6 +1702,9 @@ void Foam::ReferredCellList::referParticles << destinationReferredCell << particlesToReferOut; } + + // Remove particles after transfer + particlesToReferOut.clear(); } else { @@ -1715,6 +1718,7 @@ void Foam::ReferredCellList::referParticles storeParticles(rRL, destinationReferredCell, particlesToReferOut); } + } // Receive referred particle lists to and distribute to ReferredCells