Skip to content
Snippets Groups Projects
Commit 037e1607 authored by LEGOLAS\lenz's avatar LEGOLAS\lenz
Browse files

fixes a memory bug in the GridGenerator

parent 544fa2c8
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,14 @@ HOST GridImp::GridImp(Object* object, real startX, real startY, real startZ, rea
distribution(distribution),
level(level),
gridInterface(nullptr),
neighborIndexX(nullptr),
neighborIndexY(nullptr),
neighborIndexZ(nullptr),
neighborIndexNegative(nullptr),
sparseIndices(nullptr),
qIndices(nullptr),
qValues(nullptr),
qPatches(nullptr),
innerRegionFromFinerGrid(false),
numberOfLayers(0),
qComputationStage(qComputationStageType::ComputeQs)
......
......@@ -273,13 +273,14 @@ void GridCpuStrategy::freeMemory(SPtr<GridImp> grid)
//if(grid->gridInterface)
//delete grid->gridInterface;
delete[] grid->neighborIndexX;
delete[] grid->neighborIndexY;
delete[] grid->neighborIndexZ;
delete[] grid->neighborIndexNegative;
delete[] grid->sparseIndices;
delete[] grid->qIndices;
delete[] grid->qValues;
if( grid->neighborIndexX != nullptr ) { delete[] grid->neighborIndexX; grid->neighborIndexX = nullptr; }
if( grid->neighborIndexY != nullptr ) { delete[] grid->neighborIndexY; grid->neighborIndexY = nullptr; }
if( grid->neighborIndexZ != nullptr ) { delete[] grid->neighborIndexZ; grid->neighborIndexZ = nullptr; }
if( grid->neighborIndexNegative != nullptr ) { delete[] grid->neighborIndexNegative; grid->neighborIndexNegative = nullptr; }
if( grid->sparseIndices != nullptr ) { delete[] grid->sparseIndices; grid->sparseIndices = nullptr; }
if( grid->qIndices != nullptr ) { delete[] grid->qIndices; grid->qIndices = nullptr; }
if( grid->qValues != nullptr ) { delete[] grid->qValues; grid->qValues = nullptr; }
if( grid->qPatches != nullptr ) { delete[] grid->qPatches; grid->qPatches = nullptr; }
//delete[] grid->distribution.f;
}
......
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