Merge pull request #520 from hjelmn/valgrind_cleanness
fix memory leaks and valgrind errors
Этот коммит содержится в:
Коммит
113c890ccf
@ -37,6 +37,15 @@ int MPI_T_finalize (void)
|
||||
|
||||
if (0 == --mpit_init_count) {
|
||||
(void) ompi_info_close_components ();
|
||||
|
||||
if ((!ompi_mpi_initialized || ompi_mpi_finalized) &&
|
||||
(NULL != ompi_mpi_main_thread)) {
|
||||
/* we are not between MPI_Init and MPI_Finalize so we
|
||||
* have to free the ompi_mpi_main_thread */
|
||||
OBJ_RELEASE(ompi_mpi_main_thread);
|
||||
ompi_mpi_main_thread = NULL;
|
||||
}
|
||||
|
||||
(void) opal_finalize_util ();
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -10,7 +11,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2006-2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2006-2009 University of Houston. All rights reserved.
|
||||
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
|
||||
@ -342,7 +343,10 @@ void ompi_mpi_thread_level(int requested, int *provided)
|
||||
ompi_mpi_thread_provided = *provided = requested;
|
||||
}
|
||||
}
|
||||
ompi_mpi_main_thread = opal_thread_get_self();
|
||||
|
||||
if (!ompi_mpi_main_thread) {
|
||||
ompi_mpi_main_thread = opal_thread_get_self();
|
||||
}
|
||||
|
||||
ompi_mpi_thread_multiple = (ompi_mpi_thread_provided ==
|
||||
MPI_THREAD_MULTIPLE);
|
||||
|
@ -67,7 +67,8 @@ static char *mca_base_var_file_prefix = NULL;
|
||||
static char *mca_base_envar_file_prefix = NULL;
|
||||
static char *mca_base_param_file_path = NULL;
|
||||
static char *mca_base_env_list = NULL;
|
||||
static char *mca_base_env_list_sep = ";";
|
||||
#define MCA_BASE_ENV_LIST_SEP_DEFAULT ";"
|
||||
static char *mca_base_env_list_sep = MCA_BASE_ENV_LIST_SEP_DEFAULT;
|
||||
static char *mca_base_env_list_internal = NULL;
|
||||
static bool mca_base_var_suppress_override_warning = false;
|
||||
static opal_list_t mca_base_var_file_values;
|
||||
@ -273,6 +274,8 @@ int mca_base_var_init(void)
|
||||
"Set SHELL env variables",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3,
|
||||
MCA_BASE_VAR_SCOPE_READONLY, &mca_base_env_list);
|
||||
|
||||
mca_base_env_list_sep = MCA_BASE_ENV_LIST_SEP_DEFAULT;
|
||||
(void)mca_base_var_register ("opal", "mca", "base", "env_list_delimiter",
|
||||
"Set SHELL env variables delimiter. Default: semicolon ';'",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3,
|
||||
@ -430,6 +433,7 @@ static int mca_base_var_cache_files(bool rel_path_search)
|
||||
if (OPAL_SUCCESS != ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
mca_base_envar_files = strdup(mca_base_var_files);
|
||||
|
||||
(void) mca_base_var_register_synonym (ret, "opal", "mca", NULL, "param_files",
|
||||
@ -1131,11 +1135,15 @@ int mca_base_var_finalize(void)
|
||||
if (NULL != mca_base_var_file_list) {
|
||||
opal_argv_free(mca_base_var_file_list);
|
||||
}
|
||||
mca_base_var_file_list = NULL;
|
||||
|
||||
(void) mca_base_var_group_finalize ();
|
||||
(void) mca_base_pvar_finalize ();
|
||||
|
||||
OBJ_DESTRUCT(&mca_base_var_index_hash);
|
||||
|
||||
free (mca_base_envar_files);
|
||||
mca_base_envar_files = NULL;
|
||||
}
|
||||
|
||||
/* All done */
|
||||
@ -1241,15 +1249,31 @@ static int fixup_files(char **file_list, char * path, bool rel_path_search, char
|
||||
|
||||
static int read_files(char *file_list, opal_list_t *file_values, char sep)
|
||||
{
|
||||
int i, count;
|
||||
char **tmp = opal_argv_split(file_list, sep);
|
||||
int i, count, ret;
|
||||
|
||||
if (!tmp) {
|
||||
return OPAL_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
if (mca_base_var_file_list) {
|
||||
count = opal_argv_count (mca_base_var_file_list);
|
||||
ret = opal_argv_insert (&mca_base_var_file_list, count, tmp);
|
||||
if (OPAL_SUCCESS != ret) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
opal_argv_free (tmp);
|
||||
} else {
|
||||
mca_base_var_file_list = tmp;
|
||||
}
|
||||
|
||||
count = opal_argv_count(mca_base_var_file_list);
|
||||
|
||||
/* Iterate through all the files passed in -- read them in reverse
|
||||
order so that we preserve unix/shell path-like semantics (i.e.,
|
||||
the entries farthest to the left get precedence) */
|
||||
|
||||
mca_base_var_file_list = opal_argv_split(file_list, sep);
|
||||
count = opal_argv_count(mca_base_var_file_list);
|
||||
|
||||
for (i = count - 1; i >= 0; --i) {
|
||||
mca_base_parse_paramfile(mca_base_var_file_list[i], file_values);
|
||||
}
|
||||
|
@ -209,6 +209,7 @@ static int mca_btl_vader_component_register (void)
|
||||
"single_copy_mechanism", "Single copy mechanism to use (defaults to best available)",
|
||||
MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE,
|
||||
OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_GROUP, &mca_btl_vader_component.single_copy_mechanism);
|
||||
OBJ_RELEASE(new_enum);
|
||||
|
||||
#if OPAL_BTL_VADER_HAVE_KNEM
|
||||
/* Currently disabling DMA mode by default; it's not clear that this is useful in all applications and architectures. */
|
||||
|
@ -164,6 +164,7 @@ opal_installdirs_base_close(void)
|
||||
free(opal_install_dirs.opaldatadir);
|
||||
free(opal_install_dirs.opallibdir);
|
||||
free(opal_install_dirs.opalincludedir);
|
||||
memset (&opal_install_dirs, 0, sizeof (opal_install_dirs));
|
||||
|
||||
return mca_base_framework_components_close (&opal_installdirs_base_framework, NULL);
|
||||
}
|
||||
|
@ -104,6 +104,9 @@ opal_finalize_util(void)
|
||||
/* finalize the class/object system */
|
||||
opal_class_finalize();
|
||||
|
||||
free (opal_process_info.nodename);
|
||||
opal_process_info.nodename = NULL;
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -303,11 +303,6 @@ opal_init_util(int* pargc, char*** pargv)
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != (ret = opal_net_init())) {
|
||||
error = "opal_net_init";
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
/* Setup the parameter system */
|
||||
if (OPAL_SUCCESS != (ret = mca_base_var_init())) {
|
||||
error = "mca_base_var_init";
|
||||
@ -320,6 +315,11 @@ opal_init_util(int* pargc, char*** pargv)
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
if (OPAL_SUCCESS != (ret = opal_net_init())) {
|
||||
error = "opal_net_init";
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
/* pretty-print stack handlers */
|
||||
if (OPAL_SUCCESS != (ret = opal_util_register_stackhandlers())) {
|
||||
error = "opal_util_register_stackhandlers";
|
||||
|
@ -231,6 +231,7 @@ int opal_register_params(void)
|
||||
}
|
||||
|
||||
#if OPAL_ENABLE_TIMING
|
||||
opal_timing_sync_file = NULL;
|
||||
(void) mca_base_var_register ("opal", "opal", NULL, "timing_sync_file",
|
||||
"Clock synchronisation information generated by mpisync tool. You don't need to touch this if you use mpirun_prof tool.",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
@ -240,12 +241,14 @@ int opal_register_params(void)
|
||||
opal_output(0, "Cannot read file %s containing clock synchronisation information\n", opal_timing_sync_file);
|
||||
}
|
||||
|
||||
opal_timing_output = NULL;
|
||||
(void) mca_base_var_register ("opal", "opal", NULL, "timing_output",
|
||||
"The name of output file for timing information. If this parameter is not set then output will be directed into OPAL debug channel.",
|
||||
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
||||
OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL,
|
||||
&opal_timing_output);
|
||||
|
||||
opal_timing_overhead = true;
|
||||
(void) mca_base_var_register ("opal", "opal", NULL, "timing_overhead",
|
||||
"Timing framework introduce additional overhead (malloc's mostly)."
|
||||
" The time spend in such costly routines is measured and may be accounted"
|
||||
@ -280,9 +283,6 @@ int opal_register_params(void)
|
||||
|
||||
int opal_deregister_params(void)
|
||||
{
|
||||
opal_signal_string = NULL;
|
||||
opal_net_private_ipv4 = NULL;
|
||||
opal_set_max_sys_limits = NULL;
|
||||
opal_register_done = false;
|
||||
|
||||
return OPAL_SUCCESS;
|
||||
|
@ -182,7 +182,8 @@ int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags)
|
||||
if (NULL != opal_process_info.nodename) {
|
||||
free(opal_process_info.nodename);
|
||||
}
|
||||
opal_process_info.nodename = orte_process_info.nodename;
|
||||
/* opal_finalize_util will call free on this pointer so set from strdup */
|
||||
opal_process_info.nodename = strdup (orte_process_info.nodename);
|
||||
|
||||
/* setup the dstore framework */
|
||||
if (ORTE_SUCCESS != (ret = mca_base_framework_open(&opal_dstore_base_framework, 0))) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user