Commit e3c0a064 authored by Millian Poquet's avatar Millian Poquet

Memory bugfix: mismatched new/free fixed ; Machines::_masterMachine was not deallocated

parent f083f79d
......@@ -54,8 +54,8 @@ int execute_profile(BatsimContext *context,
MsgParallelHomogeneousProfileData * data = (MsgParallelHomogeneousProfileData *)profile->data;
// These amounts are deallocated by SG
double * computation_amount = new double[nb_res];
double * communication_amount = new double[nb_res*nb_res];
double * computation_amount = xbt_new(double, nb_res);
double * communication_amount = xbt_new(double, nb_res*nb_res);
double cpu = data->cpu;
double com = data->com;
......@@ -111,8 +111,8 @@ int execute_profile(BatsimContext *context,
MsgParallelProfileData * data = (MsgParallelProfileData *)profile->data;
// These amounts are deallocated by SG
double * computation_amount = new double[nb_res];
double * communication_amount = new double[nb_res*nb_res];
double * computation_amount = xbt_new(double, nb_res);
double * communication_amount = xbt_new(double, nb_res*nb_res);
// Let us retrieve the matrices from the profile
memcpy(computation_amount, data->cpu, sizeof(double) * nb_res);
......
......@@ -25,6 +25,10 @@ Machines::~Machines()
for (Machine * machine : _machines)
delete machine;
_machines.clear();
if (_masterMachine != nullptr)
delete _masterMachine;
_masterMachine = nullptr;
}
void Machines::createMachines(xbt_dynar_t hosts, BatsimContext *context, const string &masterHostName)
......
......@@ -189,12 +189,12 @@ MsgParallelProfileData::~MsgParallelProfileData()
{
if (cpu != nullptr)
{
delete cpu;
delete[] cpu;
cpu = nullptr;
}
if (com != nullptr)
{
delete com;
delete[] com;
com = nullptr;
}
}
......
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