Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
This dict was not freed
authorthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 14 Aug 2006 11:19:09 +0000 (11:19 +0000)
committerthiery <thiery@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 14 Aug 2006 11:19:09 +0000 (11:19 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2715 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/workstation.c
src/surf/workstation_KCCFLN05.c

index f8b2760..f9a3ac3 100644 (file)
@@ -12,8 +12,8 @@
 #include "network_private.h"
 
 surf_workstation_resource_t surf_workstation_resource = NULL;
 #include "network_private.h"
 
 surf_workstation_resource_t surf_workstation_resource = NULL;
-
 xbt_dict_t workstation_set = NULL;
 xbt_dict_t workstation_set = NULL;
+static xbt_dict_t parallel_task_network_link_set = NULL;
 
 static workstation_CLM03_t workstation_new(const char *name,
                                     void *cpu, void *card)
 
 static workstation_CLM03_t workstation_new(const char *name,
                                     void *cpu, void *card)
@@ -305,17 +305,11 @@ static surf_action_t execute_parallel_task (int workstation_nb,
 {
   surf_action_parallel_task_CSL05_t action = NULL;
   int i, j, k;
 {
   surf_action_parallel_task_CSL05_t action = NULL;
   int i, j, k;
-  static xbt_dict_t network_link_set;
-  static int first_run = 1;
   int nb_link = 0;
   int nb_host = 0;
 
   int nb_link = 0;
   int nb_host = 0;
 
-  if (first_run) {
-    network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
-    first_run = 0;
-  }
-  else {
-    xbt_dict_reset(network_link_set);
+  if (parallel_task_network_link_set == NULL) {
+    parallel_task_network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
   }
 
   /* Compute the number of affected resources... */
   }
 
   /* Compute the number of affected resources... */
@@ -328,12 +322,13 @@ static surf_action_t execute_parallel_task (int workstation_nb,
       
       if(communication_amount[i*workstation_nb+j]>0)
        for(k=0; k< route_size; k++) {
       
       if(communication_amount[i*workstation_nb+j]>0)
        for(k=0; k< route_size; k++) {
-         xbt_dict_set(network_link_set, route[k]->name, route[k], NULL);
+         xbt_dict_set(parallel_task_network_link_set, route[k]->name, route[k], NULL);
        }
     }
   }
 
        }
     }
   }
 
-  nb_link = xbt_dict_length(network_link_set);
+  nb_link = xbt_dict_length(parallel_task_network_link_set);
+  xbt_dict_reset(parallel_task_network_link_set);
 
   for (i = 0; i<workstation_nb; i++)
     if(computation_amount[i]>0) nb_host++;
 
   for (i = 0; i<workstation_nb; i++)
     if(computation_amount[i]>0) nb_host++;
index 4845325..43ba290 100644 (file)
@@ -16,6 +16,7 @@ static int nb_workstation = 0;
 static s_route_KCCFLN05_t *routing_table = NULL;
 #define ROUTE(i,j) routing_table[(i)+(j)*nb_workstation]
 static network_link_KCCFLN05_t loopback = NULL;
 static s_route_KCCFLN05_t *routing_table = NULL;
 #define ROUTE(i,j) routing_table[(i)+(j)*nb_workstation]
 static network_link_KCCFLN05_t loopback = NULL;
+static xbt_dict_t parallel_task_network_link_set = NULL;
 
 /*xbt_dict_t network_link_set = NULL;*/
 
 
 /*xbt_dict_t network_link_set = NULL;*/
 
@@ -374,6 +375,9 @@ static void finalize(void)
 
   xbt_dict_free(&network_link_set);
   xbt_dict_free(&workstation_set);
 
   xbt_dict_free(&network_link_set);
   xbt_dict_free(&workstation_set);
+  if (parallel_task_network_link_set != NULL) {
+    xbt_dict_free(&parallel_task_network_link_set);
+  }
   xbt_swag_free(surf_workstation_resource->common_public->states.
                ready_action_set);
   xbt_swag_free(surf_workstation_resource->common_public->states.
   xbt_swag_free(surf_workstation_resource->common_public->states.
                ready_action_set);
   xbt_swag_free(surf_workstation_resource->common_public->states.
@@ -557,17 +561,11 @@ static surf_action_t execute_parallel_task(int workstation_nb,
 {
   surf_action_workstation_KCCFLN05_t action = NULL;
   int i, j, k;
 {
   surf_action_workstation_KCCFLN05_t action = NULL;
   int i, j, k;
-  static xbt_dict_t network_link_set;
-  static int first_run = 1;
   int nb_link = 0;
   int nb_host = 0;
 
   int nb_link = 0;
   int nb_host = 0;
 
-  if (first_run) {
-    network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
-    first_run = 0;
-  }
-  else {
-    xbt_dict_reset(network_link_set);
+  if (parallel_task_network_link_set == NULL) {
+    parallel_task_network_link_set = xbt_dict_new_ext(workstation_nb * workstation_nb * 10);
   }
 
   /* Compute the number of affected resources... */
   }
 
   /* Compute the number of affected resources... */
@@ -580,12 +578,13 @@ static surf_action_t execute_parallel_task(int workstation_nb,
       
       if(communication_amount[i*workstation_nb+j]>0)
        for(k=0; k< route_size; k++) {
       
       if(communication_amount[i*workstation_nb+j]>0)
        for(k=0; k< route_size; k++) {
-         xbt_dict_set(network_link_set, route[k]->name, route[k], NULL);
+         xbt_dict_set(parallel_task_network_link_set, route[k]->name, route[k], NULL);
        }
     }
   }
 
        }
     }
   }
 
-  nb_link = xbt_dict_length(network_link_set);
+  nb_link = xbt_dict_length(parallel_task_network_link_set);
+  xbt_dict_reset(parallel_task_network_link_set);
 
   for (i = 0; i<workstation_nb; i++)
     if(computation_amount[i]>0) nb_host++;
 
   for (i = 0; i<workstation_nb; i++)
     if(computation_amount[i]>0) nb_host++;