Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ensures that SIMIX_clean is called automatically
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 2 Oct 2012 07:32:36 +0000 (09:32 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 2 Oct 2012 07:32:36 +0000 (09:32 +0200)
ChangeLog
include/simgrid/simix.h
src/gras/Virtu/sg_process.c
src/msg/msg_global.c
src/simix/smx_global.c
src/smpi/smpi_global.c

index fa21ecf..0e77800 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,8 @@ SimGrid (3.8) NOT RELEASED; urgency=low
    to avoid memory leaks.
  * Add an interface to auto-restart processes when the host in which they are
    executing comes back.
    to avoid memory leaks.
  * Add an interface to auto-restart processes when the host in which they are
    executing comes back.
+ * Ensures that SIMIX_clean is called automatically. It's not part of
+   the public interface anymore (bindings should be updated).
 
  SimDag:
  * New types of typed tasks. SD_TASK_COMP_PAR_AMDAHL represents a
 
  SimDag:
  * New types of typed tasks. SD_TASK_COMP_PAR_AMDAHL represents a
index 5fe3313..003500a 100644 (file)
@@ -215,7 +215,6 @@ XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
 /********************************** Global ************************************/
 /* Initialization and exit */
 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
 /********************************** Global ************************************/
 /* Initialization and exit */
 XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
-XBT_PUBLIC(void) SIMIX_clean(void);
 
 
 XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
 
 
 XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function);
index 4dfee83..96773db 100644 (file)
@@ -263,7 +263,5 @@ void gras_load_environment_script(const char *script_file)
   return;
 }
 
   return;
 }
 
-void gras_clean()
-{
-  SIMIX_clean();
+void gras_clean(){ /* this function is not needed anymore and could be removed, but I feel so lazy */
 }
 }
index 5aef61a..5e10842 100644 (file)
@@ -167,8 +167,6 @@ msg_error_t MSG_clean(void)
   TRACE_end();
 #endif
 
   TRACE_end();
 #endif
 
-  SIMIX_clean();
-
   xbt_swag_free(msg_global->vms);
   free(msg_global);
   msg_global = NULL;
   xbt_swag_free(msg_global->vms);
   free(msg_global);
   msg_global = NULL;
index 6133fcf..5a350c2 100644 (file)
@@ -22,6 +22,8 @@ static void* SIMIX_action_mallocator_new_f(void);
 static void SIMIX_action_mallocator_free_f(void* action);
 static void SIMIX_action_mallocator_reset_f(void* action);
 
 static void SIMIX_action_mallocator_free_f(void* action);
 static void SIMIX_action_mallocator_reset_f(void* action);
 
+static void SIMIX_clean(void);
+
 /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
 #include <signal.h>
 
 /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
 #include <signal.h>
 
@@ -107,6 +109,8 @@ void SIMIX_global_init(int *argc, char **argv)
 
   XBT_DEBUG("ADD SIMIX LEVELS");
   SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
 
   XBT_DEBUG("ADD SIMIX LEVELS");
   SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
+
+  atexit(SIMIX_clean);
 }
 
 /**
 }
 
 /**
@@ -115,7 +119,7 @@ void SIMIX_global_init(int *argc, char **argv)
  *
  * This functions remove the memory used by SIMIX
  */
  *
  * This functions remove the memory used by SIMIX
  */
-void SIMIX_clean(void)
+static void SIMIX_clean(void)
 {
 #ifdef TIME_BENCH_PER_SR
   smx_ctx_raw_new_sr();
 {
 #ifdef TIME_BENCH_PER_SR
   smx_ctx_raw_new_sr();
index c0706b2..43e5c0c 100644 (file)
@@ -332,6 +332,5 @@ int MAIN__(void)
   TRACE_end();
 #endif
 
   TRACE_end();
 #endif
 
-  SIMIX_clean();
   return 0;
 }
   return 0;
 }