Commit d993f5b6 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

DP2 and DP3Demi: less memory leak

parent 508e4150
......@@ -131,8 +131,11 @@ double IndepDP2::tryGuess(Instance& instance, std::vector<int> taskSet, vector<d
// Possible optimization if needed: run this test for all
// taskTypes (which appear in the taskSet) instead of for all
// tasks
if(exec0 > maxlen && exec1 > maxlen)
if(exec0 > maxlen && exec1 > maxlen){
delete[] CPUload[0];
delete[] CPUload;
return -1; // Problem is not feasible: task t cannot be placed on any resource
}
if((exec0 <= maxlen) && (exec1 <= maxlen)) {
for(int l = N; l >= discreteGPUtime; --l) {
CPUload[nextIndex][l] = min(CPUload[index][l] + exec0, CPUload[index][l - discreteGPUtime]);
......
......@@ -164,8 +164,11 @@ double IndepDP3Demi::tryGuess(Instance& instance, std::vector<int> taskSet, vect
const int muOffset = isLongOnCPU[taskType];
const int nuOffset = isLongOnGPU[taskType];
if(exec0 > target && exec1 > target)
if(exec0 > target && exec1 > target) {
delete[] CPUload[0];
delete[] CPUload;
return -1; // Problem is not feasible: task t cannot be placed on any resource
}
if(verbosity >= 8)
cout << "Task " << t << " dGPUTime="<< discreteGPUtime << " exec0=" << exec0 << " muOffset="<<muOffset << " nuOffset="<<nuOffset << endl;
......
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