Commit d3867d70 authored by Ulrich Kemloh's avatar Ulrich Kemloh

fixed leak at the end of the simulation while deleting agens

parent d1e2e9f8
......@@ -91,7 +91,7 @@ Building::~Building()
#ifdef _SIMULATOR
for(unsigned int p=0;p<_allPedestians.size();p++)
{
//delete _allPedestians[p];
delete _allPedestians[p];
}
_allPedestians.clear();
delete _linkedCellGrid;
......@@ -982,7 +982,6 @@ void Building::InitGrid(double cellSize)
Log->Write("INFO: \tInitializing the grid with cell size: %f ", cellSize);
}
//_linkedCellGrid = new LCGrid(boundaries, cellSize, _allPedestians.size());
_linkedCellGrid = new LCGrid(boundaries, cellSize, Pedestrian::GetAgentsCreated());
_linkedCellGrid->ShallowCopy(_allPedestians);
......@@ -1178,6 +1177,7 @@ void Building::DeletePedestrian(Pedestrian* &ped)
trans->IncreaseDoorUsage(1, ped->GetGlobalTime());
}
delete ped;
//ped=nullptr;
}
const vector<Pedestrian*>& Building::GetAllPedestrians() const
......
......@@ -40,7 +40,7 @@
using namespace std;
#define MAX_AGENT_COUNT 100000
#define MAX_AGENT_COUNT 1000000
LCGrid::LCGrid(double boundaries[4], double cellsize, int nPeds)
{
......@@ -78,10 +78,10 @@ LCGrid::LCGrid(double boundaries[4], double cellsize, int nPeds)
LCGrid::~LCGrid()
{
for(int i=0; i<_nPeds; i++) {
if(_localPedsCopy[i])
delete _localPedsCopy[i];
}
// for(int i=0; i<_nPeds; i++) {
// if(_localPedsCopy[i]!=nullptr)
// delete _localPedsCopy[i];
// }
delete [] _list;
delete [] _localPedsCopy;
for (int i = 0; i < _gridSizeY; ++i) delete[] _cellHead[i];
......
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