From: Martin Quinson Date: Tue, 2 Oct 2012 07:32:36 +0000 (+0200) Subject: Ensures that SIMIX_clean is called automatically X-Git-Tag: v3_8~150 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/821e14387201136b86389d5ea0bdc6c2fb4f0b10?hp=93127ef7ecd968f9c6e8ff28b674d4931a60dc23 Ensures that SIMIX_clean is called automatically --- diff --git a/ChangeLog b/ChangeLog index fa21ecf45c..0e7780040a 100644 --- 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. + * 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 diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 5fe3313051..003500a01b 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -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); -XBT_PUBLIC(void) SIMIX_clean(void); XBT_PUBLIC(void) SIMIX_function_register_process_cleanup(void_pfn_smxprocess_t function); diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index 4dfee8349b..96773db6cc 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -263,7 +263,5 @@ void gras_load_environment_script(const char *script_file) return; } -void gras_clean() -{ - SIMIX_clean(); +void gras_clean(){ /* this function is not needed anymore and could be removed, but I feel so lazy */ } diff --git a/src/msg/msg_global.c b/src/msg/msg_global.c index 5aef61aa2a..5e10842147 100644 --- a/src/msg/msg_global.c +++ b/src/msg/msg_global.c @@ -167,8 +167,6 @@ msg_error_t MSG_clean(void) TRACE_end(); #endif - SIMIX_clean(); - xbt_swag_free(msg_global->vms); free(msg_global); msg_global = NULL; diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 6133fcfd2e..5a350c2366 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -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_clean(void); + /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */ #include @@ -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); + + atexit(SIMIX_clean); } /** @@ -115,7 +119,7 @@ void SIMIX_global_init(int *argc, char **argv) * * 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(); diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index c0706b285e..43e5c0c676 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -332,6 +332,5 @@ int MAIN__(void) TRACE_end(); #endif - SIMIX_clean(); return 0; }