Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Free memory in msg/cloud examples.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 7 Feb 2014 11:15:23 +0000 (12:15 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Sat, 8 Feb 2014 09:44:14 +0000 (10:44 +0100)
examples/msg/cloud/masterslave_virtual_machines.c
examples/msg/cloud/simple_vm.c
examples/msg/cloud/two_tasks_vm.c

index 162ab1a..eb9d072 100644 (file)
@@ -85,6 +85,7 @@ int master_fun(int argc, char *argv[])
 
     XBT_INFO("put %s on %s", pr_name, vm_name);
     MSG_process_create_with_arguments(pr_name, worker_fun, NULL, vm, 2, wrk_argv);
+    xbt_free(vm_name);
   }
 
 
@@ -125,6 +126,7 @@ int master_fun(int argc, char *argv[])
 
     XBT_INFO("put %s on %s", pr_name, vm_name);
     MSG_process_create_with_arguments(pr_name, worker_fun, NULL, vm, 2, wrk_argv);
+    xbt_free(vm_name);
   }
 
   XBT_INFO("Send a task to %d worker process", workers_count * 2);
index 7c8207f..624bdc4 100644 (file)
@@ -86,6 +86,7 @@ static int communication_rx_fun(int argc, char *argv[])
       MSG_process_get_name(priv->tx_proc),
       host_name, pr_name, clock_end - priv->clock_sta);
 
+  xbt_free(priv);
   MSG_task_destroy(task);
 
   return 0;
@@ -269,6 +270,7 @@ static int master_main(int argc, char *argv[])
   MSG_vm_destroy(vm0);
   XBT_INFO("## Test 6 (ended)");
   
+  xbt_dynar_free(&hosts_dynar);
   return 0;
 }
 
@@ -298,7 +300,7 @@ int main(int argc, char *argv[])
 
   int res = MSG_main();
   XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
-
+  xbt_dynar_free(&hosts_dynar);
 
   return !(res == MSG_OK);
 }
index 5881fc5..0e2aaab 100644 (file)
@@ -76,6 +76,8 @@ static int master_main(int argc, char *argv[])
   }
 
   MSG_process_sleep(10000);
+  MSG_vm_destroy(vm0);
+  xbt_dynar_free(&hosts_dynar);
   return 1;
 }
 
@@ -101,6 +103,7 @@ int main(int argc, char *argv[]){
 
   int res = MSG_main();
   XBT_INFO("Bye (simulation time %g)", MSG_get_clock());
+  xbt_dynar_free(&hosts_dynar);
 
   return !(res == MSG_OK);
 }