Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug a bunch of memleaks in SD examples
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 26 Jun 2016 12:02:28 +0000 (14:02 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 26 Jun 2016 12:18:27 +0000 (14:18 +0200)
examples/simdag/availability/sd_availability.c
examples/simdag/dag-dotload/sd_dag-dotload.c
examples/simdag/daxload/sd_daxload.c
examples/simdag/io/sd_io.c
examples/simdag/ptg-dotload/sd_ptg-dotload.c
examples/simdag/test/sd_test.cpp
examples/simdag/throttling/sd_throttling.c

index 45f0a16..c6c053a 100644 (file)
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
 {
   SD_init(&argc, argv);
   SD_create_environment(argv[1]);
-  const sg_host_t *hosts = sg_host_list();
+  sg_host_t *hosts = sg_host_list();
 
   SD_task_t t1 = SD_task_create_comp_seq("t1", NULL, 25000000);
   SD_task_t c1 = SD_task_create_comm_e2e("c1", NULL, 125000000);
@@ -94,5 +94,6 @@ int main(int argc, char **argv)
     }
   }
   SD_exit();
+  xbt_free(hosts);
   return 0;
 }
index a2006ba..2f88d5e 100644 (file)
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
 
   /* Schedule them all on the first workstation */
   XBT_INFO("------------------- Schedule tasks ---------------------------");
-  const sg_host_t *ws_list = sg_host_list();
+  sg_host_t *ws_list = sg_host_list();
 
   int count = sg_host_count();
   xbt_dynar_foreach(dot, cursor, task) {
@@ -71,6 +71,7 @@ int main(int argc, char **argv)
         SD_task_schedulel(task, 1, ws_list[cursor % count]);
     }
   }
+  xbt_free(ws_list);
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
index 1734949..ed2eb41 100644 (file)
@@ -64,18 +64,19 @@ int main(int argc, char **argv)
 
   /* Schedule them all on the first host */
   XBT_INFO("------------------- Schedule tasks ---------------------------");
-  const sg_host_t *ws_list = sg_host_list();
+  sg_host_t *host_list = sg_host_list();
   int hosts_count = sg_host_count();
-  qsort((void *) ws_list, hosts_count, sizeof(sg_host_t), name_compare_hosts);
+  qsort((void *) host_list, hosts_count, sizeof(sg_host_t), name_compare_hosts);
 
   xbt_dynar_foreach(dax, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_SEQ) {
       if (!strcmp(SD_task_get_name(task), "end"))
-        SD_task_schedulel(task, 1, ws_list[0]);
+        SD_task_schedulel(task, 1, host_list[0]);
       else
-        SD_task_schedulel(task, 1, ws_list[cursor % hosts_count]);
+        SD_task_schedulel(task, 1, host_list[cursor % hosts_count]);
     }
   }
+  xbt_free(host_list);
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
index a04c20b..e2cdbbc 100644 (file)
@@ -21,16 +21,17 @@ int main(int argc, char **argv)
   /* Set the workstation model to default, as storage is not supported by the ptask_L07 model yet. */
   SD_config("host/model", "default");
   SD_create_environment(argv[1]);
-  const sg_host_t *workstations = sg_host_list();
-  int total_nworkstations = sg_host_count();
+  sg_host_t *hosts = sg_host_list();
+  int total_nhosts = sg_host_count();
 
-  for (ctr=0; ctr<total_nworkstations;ctr++){
-    current_storage_list = sg_host_get_mounted_storage_list(workstations[ctr]);
+  for (ctr=0; ctr<total_nhosts;ctr++){
+    current_storage_list = sg_host_get_mounted_storage_list(hosts[ctr]);
     xbt_dict_foreach(current_storage_list,cursor,mount_name,storage_name)
-      XBT_INFO("Workstation '%s' mounts '%s'", sg_host_get_name(workstations[ctr]), mount_name);
+      XBT_INFO("Workstation '%s' mounts '%s'", sg_host_get_name(hosts[ctr]), mount_name);
     xbt_dict_free(&current_storage_list);
   }
 
   SD_exit();
+  xbt_free(hosts);
   return 0;
 }
index 8b30e0c..1ac5e62 100644 (file)
@@ -40,13 +40,14 @@ int main(int argc, char **argv){
 
   /* Schedule them all on all the first host*/
   XBT_INFO("------------------- Schedule tasks ---------------------------");
-  const sg_host_t *hosts = sg_host_list();
+  sg_host_t *hosts = sg_host_list();
   int count = sg_host_count();
   xbt_dynar_foreach(dot, cursor, task) {
     if (SD_task_get_kind(task) == SD_TASK_COMP_PAR_AMDAHL) {
         SD_task_schedulev(task, count, hosts);
     }
   }
+  xbt_free(hosts);
 
   XBT_INFO("------------------- Run the schedule ---------------------------");
   SD_simulate(-1);
index 0815389..f4eaf75 100644 (file)
@@ -41,12 +41,12 @@ int main(int argc, char **argv)
   XBT_INFO("Computation time for %f flops on %s: %f", comp_amount2, name2, comp_amount2/sg_host_speed(h2));
 
   XBT_INFO("Route between %s and %s:", name1, name2);
-  const SD_link_t *route = SD_route_get_list(h1, h2);
+  SD_link_t *route = SD_route_get_list(h1, h2);
   int route_size = SD_route_get_size(h1, h2);
-  for (int i = 0; i < route_size; i++) {
+  for (int i = 0; i < route_size; i++)
     XBT_INFO("   Link %s: latency = %f, bandwidth = %f", sg_link_name(route[i]), sg_link_latency(route[i]),
              sg_link_bandwidth(route[i]));
-  }
+  xbt_free(route);
   XBT_INFO("Route latency = %f, route bandwidth = %f", SD_route_get_latency(h1, h2), SD_route_get_bandwidth(h1, h2));
   XBT_INFO("Communication time for %f bytes between %s and %s: %f", comm_amount12, name1, name2,
         SD_route_get_latency(h1, h2) + comm_amount12 / SD_route_get_bandwidth(h1, h2));
index fef44bc..65f2401 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char **argv)
 
   SD_create_environment(argv[1]);
 
-  const sg_host_t *hosts = sg_host_list();
+  sg_host_t *hosts = sg_host_list();
 
   /* creation of some typed tasks and their dependencies */
   /* chain of five tasks, three compute tasks with two data transfers in between */
@@ -69,5 +69,6 @@ int main(int argc, char **argv)
 
   XBT_DEBUG("Tasks destroyed. Exiting SimDag...");
   SD_exit();
+  xbt_free(hosts);
   return 0;
 }