orte: fix several small memory leaks
grpcomm: fix memory leaks We were leaking the caddy object used to pass data to the callback function. This commit fixes these leaks. oob,rml: fix memory leaks This commit fixes several leaks: - Both the oob/base and oob/tcp were leaking objects on their peer hash tables. Iterate on the hash tables and free any objects. - Leaked sent messages because of missing OBJ_RELEASE. I placed the release in ORTE_RML_SEND_COMPLETE to catch all the possible paths. ess/base: close the state framework cmr=v1.8.2:reviewer=rhc This commit was SVN r31776.
Этот коммит содержится в:
родитель
7b4afe7efe
Коммит
59d09ad9de
@ -398,6 +398,7 @@ int orte_ess_base_app_finalize(void)
|
||||
|
||||
(void) mca_base_framework_close(&orte_rml_base_framework);
|
||||
(void) mca_base_framework_close(&orte_oob_base_framework);
|
||||
(void) mca_base_framework_close(&orte_state_base_framework);
|
||||
|
||||
/* release the event base */
|
||||
opal_event_base_free(orte_event_base);
|
||||
|
@ -142,6 +142,8 @@ static void process_barrier(int fd, short args, void *cbdata)
|
||||
opal_buffer_t *buf;
|
||||
orte_namelist_t *nm;
|
||||
|
||||
OBJ_RELEASE(caddy);
|
||||
|
||||
/* if we are a singleton and routing isn't enabled,
|
||||
* then we have nobody with which to communicate, so
|
||||
* we can just declare success
|
||||
@ -216,6 +218,8 @@ static void process_allgather(int fd, short args, void *cbdata)
|
||||
orte_namelist_t *nm;
|
||||
opal_list_item_t *item;
|
||||
|
||||
OBJ_RELEASE(caddy);
|
||||
|
||||
/* if we are a singleton and routing isn't enabled,
|
||||
* then we have nobody with which to communicate, so
|
||||
* we can just declare success
|
||||
|
@ -74,6 +74,8 @@ void orte_grpcomm_base_modex(int fd, short args, void *cbdata)
|
||||
bool found;
|
||||
orte_grpcomm_collective_t *cptr;
|
||||
|
||||
OBJ_RELEASE(caddy);
|
||||
|
||||
OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base_framework.framework_output,
|
||||
"%s grpcomm:base:modex: performing modex",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -10,7 +11,8 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
|
||||
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -63,17 +65,32 @@ static int orte_oob_base_close(void)
|
||||
{
|
||||
mca_oob_base_component_t *component;
|
||||
mca_base_component_list_item_t *cli;
|
||||
opal_object_t *value;
|
||||
uint64_t key;
|
||||
void *node;
|
||||
int rc;
|
||||
|
||||
/* shutdown all active transports */
|
||||
OPAL_LIST_FOREACH(cli, &orte_oob_base.actives, mca_base_component_list_item_t) {
|
||||
while (NULL != (cli = (mca_base_component_list_item_t *) opal_list_remove_first (&orte_oob_base.actives))) {
|
||||
component = (mca_oob_base_component_t*)cli->cli_component;
|
||||
if (NULL != component->shutdown) {
|
||||
component->shutdown();
|
||||
}
|
||||
OBJ_RELEASE(cli);
|
||||
}
|
||||
|
||||
/* destruct our internal lists */
|
||||
OBJ_DESTRUCT(&orte_oob_base.actives);
|
||||
|
||||
/* release all peers from the hash table */
|
||||
rc = opal_hash_table_get_first_key_uint64 (&orte_oob_base.peers, &key,
|
||||
(void **) &value, &node);
|
||||
while (OPAL_SUCCESS == rc) {
|
||||
OBJ_RELEASE(value);
|
||||
rc = opal_hash_table_get_next_key_uint64 (&orte_oob_base.peers, &key,
|
||||
(void **) &value, node, &node);
|
||||
}
|
||||
|
||||
OBJ_DESTRUCT(&orte_oob_base.peers);
|
||||
|
||||
return mca_base_framework_components_close(&orte_oob_base_framework, NULL);
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
@ -42,6 +43,9 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
opal_list_t myvals;
|
||||
opal_value_t *kv;
|
||||
|
||||
/* done with this. release it now */
|
||||
OBJ_RELEASE(cd);
|
||||
|
||||
opal_output_verbose(5, orte_oob_base_framework.framework_output,
|
||||
"%s oob:base:send to target %s",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
@ -74,7 +78,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
ORTE_ERROR_LOG(ORTE_ERR_ADDRESSEE_UNKNOWN);
|
||||
msg->status = ORTE_ERR_ADDRESSEE_UNKNOWN;
|
||||
ORTE_RML_SEND_COMPLETE(msg);
|
||||
OBJ_RELEASE(cd);
|
||||
OPAL_LIST_DESTRUCT(&myvals);
|
||||
return;
|
||||
}
|
||||
@ -82,7 +85,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
ORTE_ERROR_LOG(ORTE_ERR_ADDRESSEE_UNKNOWN);
|
||||
msg->status = ORTE_ERR_ADDRESSEE_UNKNOWN;
|
||||
ORTE_RML_SEND_COMPLETE(msg);
|
||||
OBJ_RELEASE(cd);
|
||||
OPAL_LIST_DESTRUCT(&myvals);
|
||||
return;
|
||||
}
|
||||
@ -107,7 +109,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
ORTE_ERROR_LOG(rc);
|
||||
msg->status = ORTE_ERR_ADDRESSEE_UNKNOWN;
|
||||
ORTE_RML_SEND_COMPLETE(msg);
|
||||
OBJ_RELEASE(cd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -122,7 +123,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
if (!reachable) {
|
||||
msg->status = ORTE_ERR_ADDRESSEE_UNKNOWN;
|
||||
ORTE_RML_SEND_COMPLETE(msg);
|
||||
OBJ_RELEASE(cd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -139,7 +139,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),
|
||||
ORTE_NAME_PRINT(&msg->dst));
|
||||
if (ORTE_SUCCESS == (rc = pr->component->send_nb(msg))) {
|
||||
OBJ_RELEASE(cd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -170,7 +169,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
ORTE_ERROR_LOG(rc);
|
||||
msg->status = rc;
|
||||
ORTE_RML_SEND_COMPLETE(msg);
|
||||
OBJ_RELEASE(cd);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -186,7 +184,6 @@ void orte_oob_base_send_nb(int fd, short args, void *cbdata)
|
||||
msg->status = ORTE_ERR_NO_PATH_TO_TARGET;
|
||||
ORTE_RML_SEND_COMPLETE(msg);
|
||||
}
|
||||
OBJ_RELEASE(cd);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
@ -9,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006-2013 Los Alamos National Security, LLC.
|
||||
* Copyright (c) 2006-2014 Los Alamos National Security, LLC.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
|
||||
@ -180,6 +181,10 @@ static int tcp_component_close(void)
|
||||
{
|
||||
int i;
|
||||
mca_oob_tcp_module_t *mod;
|
||||
opal_object_t *value;
|
||||
uint64_t key;
|
||||
void *node;
|
||||
int rc;
|
||||
|
||||
/* don't cleanup the listen thread as it wasn't constructed
|
||||
* for anything other than the HNP, and we don't want to incur
|
||||
@ -215,6 +220,15 @@ static int tcp_component_close(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* release all peers from the hash table */
|
||||
rc = opal_hash_table_get_first_key_uint64 (&mca_oob_tcp_component.peers, &key,
|
||||
(void **) &value, &node);
|
||||
while (OPAL_SUCCESS == rc) {
|
||||
OBJ_RELEASE(value);
|
||||
rc = opal_hash_table_get_next_key_uint64 (&mca_oob_tcp_component.peers, &key,
|
||||
(void **) &value, node, &node);
|
||||
}
|
||||
|
||||
OBJ_DESTRUCT(&mca_oob_tcp_component.peers);
|
||||
|
||||
return ORTE_SUCCESS;
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana
|
||||
* University Research and Technology
|
||||
@ -9,7 +10,7 @@
|
||||
* University of Stuttgart. All rights reserved.
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
|
||||
* Copyright (c) 2007-2014 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -228,6 +229,7 @@ OBJ_CLASS_DECLARATION(orte_rml_recv_request_t);
|
||||
(m)->buffer, \
|
||||
(m)->tag, (m)->cbdata); \
|
||||
} \
|
||||
OBJ_RELEASE(m); \
|
||||
}while(0);
|
||||
|
||||
/*
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user