Commit cd304bf7 authored by Martin Khannouz's avatar Martin Khannouz Committed by Berenger Bramas

Fix memory leak from the previous commit.

parent a9511bb8
...@@ -94,6 +94,7 @@ protected: ...@@ -94,6 +94,7 @@ protected:
std::vector< std::vector< std::vector<BlockInteractions<CellContainerClass>>>> externalInteractionsAllLevel; std::vector< std::vector< std::vector<BlockInteractions<CellContainerClass>>>> externalInteractionsAllLevel;
std::vector< std::vector<BlockInteractions<ParticleGroupClass>>> externalInteractionsLeafLevel; std::vector< std::vector<BlockInteractions<ParticleGroupClass>>> externalInteractionsLeafLevel;
std::list<const std::vector<OutOfBlockInteraction>*> externalInteractionsLeafLevelOpposite;
OctreeClass*const tree; //< The Tree OctreeClass*const tree; //< The Tree
KernelClass*const originalCpuKernel; KernelClass*const originalCpuKernel;
...@@ -349,9 +350,11 @@ public: ...@@ -349,9 +350,11 @@ public:
starpu_arbiter_destroy(arbiterGlobal); starpu_arbiter_destroy(arbiterGlobal);
#endif #endif
for(auto externalInteraction : externalInteractionsLeafLevelOpposite)
delete externalInteraction;
starpu_mpi_shutdown(); starpu_mpi_shutdown();
starpu_shutdown(); starpu_shutdown();
//MPI_Finalize(); //TODO put it somewhere else, it's really dirty here.
} }
void rebuildInteractions(){ void rebuildInteractions(){
...@@ -1663,23 +1666,22 @@ protected: ...@@ -1663,23 +1666,22 @@ protected:
#endif #endif
#endif #endif
0); 0);
std::vector<OutOfBlockInteraction> outsideInteractions_2 = externalInteractionsLeafLevel[idxGroup][idxInteraction].interactions; std::vector<OutOfBlockInteraction>* outsideInteractionsOpposite = new std::vector<OutOfBlockInteraction>(externalInteractionsLeafLevel[idxGroup][idxInteraction].interactions);
for(int i = 0; i < outsideInteractions_2.size(); ++i) for(int i = 0; i < outsideInteractionsOpposite->size(); ++i)
{ {
MortonIndex tmp = outsideInteractions_2[i].outIndex; MortonIndex tmp = outsideInteractionsOpposite->at(i).outIndex;
outsideInteractions_2[i].outIndex = outsideInteractions_2[i].insideIndex; outsideInteractionsOpposite->at(i).outIndex = outsideInteractionsOpposite->at(i).insideIndex;
outsideInteractions_2[i].insideIndex = tmp; outsideInteractionsOpposite->at(i).insideIndex = tmp;
int tmp2 = outsideInteractions_2[i].insideIdxInBlock; int tmp2 = outsideInteractionsOpposite->at(i).insideIdxInBlock;
outsideInteractions_2[i].insideIdxInBlock = outsideInteractions_2[i].outsideIdxInBlock; outsideInteractionsOpposite->at(i).insideIdxInBlock = outsideInteractionsOpposite->at(i).outsideIdxInBlock;
outsideInteractions_2[i].outsideIdxInBlock = tmp2; outsideInteractionsOpposite->at(i).outsideIdxInBlock = tmp2;
outsideInteractions_2[i].relativeOutPosition = getOppositeInterIndex(outsideInteractions_2[i].relativeOutPosition); outsideInteractionsOpposite->at(i).relativeOutPosition = getOppositeInterIndex(outsideInteractionsOpposite->at(i).relativeOutPosition);
} }
//TODO delete when done in the destructor externalInteractionsLeafLevelOpposite.push_front(outsideInteractionsOpposite);
std::vector<OutOfBlockInteraction>* c = new std::vector<OutOfBlockInteraction>(outsideInteractions_2);
starpu_mpi_insert_task(MPI_COMM_WORLD, starpu_mpi_insert_task(MPI_COMM_WORLD,
&p2p_cl_inout_mpi, &p2p_cl_inout_mpi,
STARPU_VALUE, &wrapperptr, sizeof(wrapperptr), STARPU_VALUE, &wrapperptr, sizeof(wrapperptr),
STARPU_VALUE, &c, sizeof(c), STARPU_VALUE, &outsideInteractionsOpposite, sizeof(outsideInteractionsOpposite),
STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int), STARPU_VALUE, &particleHandles[idxGroup].intervalSize, sizeof(int),
#ifdef SCALFMM_STARPU_USE_PRIO #ifdef SCALFMM_STARPU_USE_PRIO
STARPU_PRIORITY, PrioClass::Controller().getInsertionPosP2PExtern(), STARPU_PRIORITY, PrioClass::Controller().getInsertionPosP2PExtern(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment