Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
when scheduling the same application more than once, better to free
authorsuter <frederic.suter@cc.in2p3.fr>
Tue, 22 Jan 2013 11:13:42 +0000 (12:13 +0100)
committersuter <frederic.suter@cc.in2p3.fr>
Tue, 22 Jan 2013 13:10:27 +0000 (14:10 +0100)
remaining stuff before allocating them again

src/simdag/sd_task.c

index 2957509..058e3bf 100644 (file)
@@ -1386,9 +1386,10 @@ void SD_task_distribute_comp_amdhal(SD_task_t task, int ws_count)
               "Task %s is not a SD_TASK_COMP_PAR_AMDAHL typed task."
               "Cannot use this function.",
               SD_task_get_name(task));  
-              
   task->computation_amount = xbt_new0(double, ws_count);
   task->communication_amount = xbt_new0(double, ws_count * ws_count);
+  if (task->workstation_list)
+    xbt_free(task->workstation_list);
   task->workstation_nb = ws_count;
   task->workstation_list = xbt_new0(SD_workstation_t, ws_count);
   
@@ -1538,6 +1539,10 @@ void SD_task_schedulev(SD_task_t task, int count,
                task->workstation_list[i];
 
           before->workstation_nb += count;
+          if (before->computation_amount)
+            xbt_free(before->computation_amount);
+          if (before->communication_amount)
+            xbt_free(before->communication_amount);
 
           before->computation_amount = xbt_new0(double,
                                                 before->workstation_nb);
@@ -1603,6 +1608,11 @@ void SD_task_schedulev(SD_task_t task, int count,
 
           after->workstation_nb += count;
 
+          if (after->computation_amount)
+            xbt_free(after->computation_amount);
+          if (after->communication_amount)
+            xbt_free(after->communication_amount);
+
           after->computation_amount = xbt_new0(double, after->workstation_nb);
           after->communication_amount = xbt_new0(double,
                                                  after->workstation_nb*