Fix a pile of memory leaks in ORTE.
Fix a major memory leak in the SLURM RAS, and cleanup a bit of code there. This commit was SVN r14164.
Этот коммит содержится в:
родитель
6fb94b3ded
Коммит
9cb455272b
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
@ -120,13 +120,13 @@ static int pls_slurm_launch_job(orte_jobid_t jobid)
|
||||
size_t num_nodes;
|
||||
orte_vpid_t vpid;
|
||||
orte_vpid_t start_vpid;
|
||||
char *jobid_string;
|
||||
char *jobid_string = NULL;
|
||||
char *uri, *param;
|
||||
char **argv;
|
||||
int argc;
|
||||
int rc;
|
||||
char *tmp;
|
||||
char** env;
|
||||
char** env = NULL;
|
||||
char* var;
|
||||
char *nodelist_flat;
|
||||
char **nodelist_argv;
|
||||
@ -246,6 +246,7 @@ static int pls_slurm_launch_job(orte_jobid_t jobid)
|
||||
opal_argv_append(&nodelist_argc, &nodelist_argv, node->nodename);
|
||||
}
|
||||
nodelist_flat = opal_argv_join(nodelist_argv, ',');
|
||||
opal_argv_free(nodelist_argv);
|
||||
asprintf(&tmp, "--nodelist=%s", nodelist_flat);
|
||||
opal_argv_append(&argc, &argv, tmp);
|
||||
free(tmp);
|
||||
@ -435,6 +436,12 @@ static int pls_slurm_launch_job(orte_jobid_t jobid)
|
||||
|
||||
cleanup:
|
||||
OBJ_RELEASE(map);
|
||||
opal_argv_free(argv);
|
||||
opal_argv_free(env);
|
||||
|
||||
if(NULL != jobid_string) {
|
||||
free(jobid_string);
|
||||
}
|
||||
|
||||
while (NULL != (item = opal_list_remove_first(&daemons))) {
|
||||
OBJ_RELEASE(item);
|
||||
|
@ -166,7 +166,7 @@ static int orte_ras_slurm_discover(char *regexp, char *tasks_per_node,
|
||||
opal_list_t* nodelist)
|
||||
{
|
||||
int i, j, len, ret, count, reps, num_nodes;
|
||||
char *base, **names = NULL, *temp;
|
||||
char *base, **names = NULL;
|
||||
char *begptr, *endptr, *orig;
|
||||
int *slots;
|
||||
bool found_range = false;
|
||||
@ -248,12 +248,7 @@ static int orte_ras_slurm_discover(char *regexp, char *tasks_per_node,
|
||||
/* If we didn't find a range, just add the node */
|
||||
opal_output(orte_ras_base.ras_output,
|
||||
"ras:slurm:allocate:discover: found node %s", base);
|
||||
if(NULL == (temp = strdup(base))) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
free(orig);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
if(ORTE_SUCCESS != (ret = opal_argv_append_nosize(&names, temp))) {
|
||||
if(ORTE_SUCCESS != (ret = opal_argv_append_nosize(&names, base))) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
free(orig);
|
||||
return ret;
|
||||
@ -423,9 +418,9 @@ static int orte_ras_slurm_parse_ranges(char *base, char *ranges, char ***names)
|
||||
*/
|
||||
static int orte_ras_slurm_parse_range(char *base, char *range, char ***names)
|
||||
{
|
||||
char *str, temp1[BUFSIZ], temp2[BUFSIZ];
|
||||
char *str, temp1[BUFSIZ];
|
||||
size_t i, j, start, end;
|
||||
size_t base_len, len;
|
||||
size_t base_len, len, num_len;
|
||||
size_t str_start, str_end;
|
||||
size_t num_str_len;
|
||||
bool found;
|
||||
@ -490,34 +485,34 @@ static int orte_ras_slurm_parse_range(char *base, char *range, char ***names)
|
||||
|
||||
/* Make strings for all values in the range */
|
||||
|
||||
for (i = start; i <= end; ++i) {
|
||||
len = base_len + 32;
|
||||
len = base_len + num_str_len + 32;
|
||||
str = malloc(len);
|
||||
if (NULL == str) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
str[0] = '\0';
|
||||
snprintf(temp1, BUFSIZ - 1, "%s", base);
|
||||
snprintf(temp2, BUFSIZ - 1, "%lu", (long) i);
|
||||
temp1[BUFSIZ - 1] = temp2[BUFSIZ - 1] = '\0';
|
||||
strcpy(str, base);
|
||||
for (i = start; i <= end; ++i) {
|
||||
str[base_len] = '\0';
|
||||
snprintf(temp1, BUFSIZ - 1, "%lu", (long) i);
|
||||
|
||||
/* Do we need zero pading? */
|
||||
|
||||
if (strlen(temp2) < num_str_len) {
|
||||
for (j = 0; j < num_str_len - strlen(temp2); ++j) {
|
||||
strcat(temp1, "0");
|
||||
if ((num_len = strlen(temp1)) < num_str_len) {
|
||||
for (j = base_len; j < base_len + (num_str_len - num_len); ++j) {
|
||||
str[j] = '0';
|
||||
}
|
||||
str[j] = '\0';
|
||||
}
|
||||
snprintf(str, len - 1, "%s%s", temp1, temp2);
|
||||
str[len - 1] = '\0';
|
||||
strcat(str, temp1);
|
||||
ret = opal_argv_append_nosize(names, str);
|
||||
if(ORTE_SUCCESS != ret) {
|
||||
ORTE_ERROR_LOG(ret);
|
||||
free(str);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
free(str);
|
||||
|
||||
/* All done */
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
@ -74,6 +74,10 @@ int orte_rds_base_close(void)
|
||||
mca_base_components_close(orte_rds_base.rds_output,
|
||||
&orte_rds_base.rds_components, NULL);
|
||||
|
||||
if(-1 != orte_rds_base.rds_output) {
|
||||
opal_output_close(orte_rds_base.rds_output);
|
||||
}
|
||||
|
||||
OBJ_DESTRUCT(&orte_rds_base.rds_selected);
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
||||
@ -113,7 +113,6 @@ int orte_rds_base_open(void)
|
||||
|
||||
/* Debugging / verbose output */
|
||||
|
||||
orte_rds_base.rds_output = opal_output_open(NULL);
|
||||
param = mca_base_param_reg_int_name("rds_base", "verbose",
|
||||
"Verbosity level for the rds framework",
|
||||
false, false, 0, &value);
|
||||
|
@ -552,6 +552,9 @@ cleanup:
|
||||
OBJ_RELEASE(values[i]);
|
||||
}
|
||||
}
|
||||
if(NULL != segment) {
|
||||
free(segment);
|
||||
}
|
||||
if(NULL != values)
|
||||
free(values);
|
||||
return rc;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
* Corporation. All rights reserved.
|
||||
* Copyright (c) 2004-2006 The University of Tennessee and The University
|
||||
@ -758,6 +758,8 @@ cleanup:
|
||||
OBJ_DESTRUCT(&max_used_nodes);
|
||||
OBJ_DESTRUCT(&fully_used_nodes);
|
||||
OBJ_DESTRUCT(&mapped_node_list);
|
||||
OBJ_RELEASE(map);
|
||||
|
||||
|
||||
free(save_bookmark);
|
||||
|
||||
|
@ -154,6 +154,7 @@ int orte_pre_condition_transports(orte_app_context_t **app_context, size_t num_c
|
||||
}
|
||||
|
||||
free(cs_env);
|
||||
free(format);
|
||||
free(string_key);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user