1
1

fix misc memory leaks specific to the master

Этот коммит содержится в:
Gilles Gouaillardet 2014-11-19 17:21:43 +09:00
родитель 38879cf682
Коммит a6744b8177
14 изменённых файлов: 75 добавлений и 14 удалений

Просмотреть файл

@ -891,6 +891,7 @@ int opal_proc_table_remove_all(opal_proc_table_t *pt) {
do {
if (NULL != vpids) {
opal_hash_table_remove_all(vpids);
OBJ_RELEASE(vpids);
}
rc = opal_hash_table_get_next_key_uint32 (&pt->super, &jobid,
(void **) &vpids, node, &node);
@ -940,7 +941,12 @@ int opal_proc_table_remove_value(opal_proc_table_t* pt, opal_process_name_t key)
if (OPAL_SUCCESS != (rc=opal_hash_table_get_value_uint32(&pt->super, key.jobid, (void **)&vpids))) {
return rc;
}
rc = opal_hash_table_remove_value_uint32(vpids, key.vpid);
if (OPAL_SUCCESS == (rc=opal_hash_table_remove_value_uint32(vpids, key.vpid))) {
if (0 == vpids->ht_size) {
opal_hash_table_remove_value_uint32(&pt->super, key.jobid);
OBJ_RELEASE(vpids);
}
}
return rc;
}

Просмотреть файл

@ -91,6 +91,9 @@ void mca_btl_tcp_proc_destruct(mca_btl_tcp_proc_t* tcp_proc)
if(NULL != tcp_proc->proc_endpoints) {
free(tcp_proc->proc_endpoints);
}
if(NULL != tcp_proc->proc_addrs) {
free(tcp_proc->proc_addrs);
}
OBJ_DESTRUCT(&tcp_proc->proc_lock);
}

Просмотреть файл

@ -120,7 +120,7 @@ OPAL_DECLSPEC int opal_dstore_base_get_handle(int dstorehandle, void **dhdl);
/* support */
OPAL_DECLSPEC opal_dstore_proc_data_t* opal_dstore_base_lookup_proc(opal_proc_table_t *jtable,
opal_process_name_t id);
opal_process_name_t id, bool create);
OPAL_DECLSPEC opal_value_t* opal_dstore_base_lookup_keyval(opal_dstore_proc_data_t *proc_data,
const char *key);

Просмотреть файл

@ -2,6 +2,8 @@
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -131,8 +133,19 @@ OBJ_CLASS_INSTANCE(opal_dstore_proc_data_t,
proc_data_construct,
proc_data_destruct);
static void attr_construct(opal_dstore_attr_t *attr)
{
attr->connection_info = NULL;
}
static void attr_destruct(opal_dstore_attr_t *attr)
{
if (NULL != attr->connection_info) {
free(attr->connection_info);
}
}
OBJ_CLASS_INSTANCE(opal_dstore_attr_t,
opal_list_item_t,
NULL, NULL);
attr_construct, attr_destruct);

Просмотреть файл

@ -256,13 +256,12 @@ opal_value_t* opal_dstore_base_lookup_keyval(opal_dstore_proc_data_t *proc_data,
* opal_process_name_t.
*/
opal_dstore_proc_data_t* opal_dstore_base_lookup_proc(opal_proc_table_t *ptable,
opal_process_name_t id)
opal_process_name_t id, bool create)
{
opal_dstore_proc_data_t *proc_data = NULL;
opal_proc_table_get_value(ptable, id, (void**)&proc_data);
if (NULL == proc_data) {
/* The proc clearly exists, so create a data structure for it */
if (NULL == proc_data && create) {
proc_data = OBJ_NEW(opal_dstore_proc_data_t);
if (NULL == proc_data) {
opal_output(0, "dstore:hash:lookup_opal_proc: unable to allocate proc_data_t\n");

Просмотреть файл

@ -116,7 +116,7 @@ static int store(struct opal_dstore_base_module_t *imod,
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), OPAL_NAME_PRINT(*id));
/* lookup the proc data object for this proc */
if (NULL == (proc_data = opal_dstore_base_lookup_proc(&mod->ptable, *id))) {
if (NULL == (proc_data = opal_dstore_base_lookup_proc(&mod->ptable, *id, true))) {
/* unrecoverable error */
OPAL_OUTPUT_VERBOSE((5, opal_dstore_base_framework.framework_output,
"%s dstore:hash:store: storing data for proc %s unrecoverably failed",
@ -169,7 +169,7 @@ static int fetch(struct opal_dstore_base_module_t *imod,
(NULL == key) ? "NULL" : key, OPAL_NAME_PRINT(*id)));
/* lookup the proc data object for this proc */
if (NULL == (proc_data = opal_dstore_base_lookup_proc(&mod->ptable, *id))) {
if (NULL == (proc_data = opal_dstore_base_lookup_proc(&mod->ptable, *id, true))) {
OPAL_OUTPUT_VERBOSE((5, opal_dstore_base_framework.framework_output,
"%s dstore_hash:fetch data for proc %s not found",
OPAL_NAME_PRINT(OPAL_PROC_MY_NAME),
@ -228,7 +228,7 @@ static int remove_data(struct opal_dstore_base_module_t *imod,
mod = (mca_dstore_hash_module_t*)imod;
/* lookup the specified proc */
if (NULL == (proc_data = opal_dstore_base_lookup_proc(&mod->ptable, *id))) {
if (NULL == (proc_data = opal_dstore_base_lookup_proc(&mod->ptable, *id, false))) {
/* no data for this proc */
return OPAL_SUCCESS;
}

Просмотреть файл

@ -12,6 +12,8 @@
* All rights reserved.
* Copyright (c) 2011-2012 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -68,9 +70,18 @@ static void gccon(orte_grpcomm_caddy_t *p)
p->cbfunc = NULL;
p->cbdata = NULL;
}
static void gcdes(orte_grpcomm_caddy_t *p)
{
if (NULL != p->sig) {
OBJ_RELEASE(p->sig);
}
p->buf = NULL;
p->cbfunc = NULL;
p->cbdata = NULL;
}
static OBJ_CLASS_INSTANCE(orte_grpcomm_caddy_t,
opal_object_t,
gccon, NULL);
gccon, gcdes);
int orte_grpcomm_API_xcast(orte_grpcomm_signature_t *sig,
orte_rml_tag_t tag,

Просмотреть файл

@ -6,6 +6,8 @@
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All
* rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -362,8 +364,11 @@ static void xcast_recv(int status, orte_process_name_t* sender,
*/
if (ORTE_PROC_IS_HNP) {
/* no need - already have the info */
if (NULL != bo->bytes) {
free(bo->bytes);
if (NULL != bo) {
if (NULL != bo->bytes) {
free(bo->bytes);
}
free(bo);
}
} else {
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base_framework.framework_output,
@ -409,6 +414,7 @@ static void xcast_recv(int status, orte_process_name_t* sender,
/* done with the wireup buffer - dump it */
OBJ_DESTRUCT(&wireup);
}
free(bo);
/* copy the remainder of the payload */
opal_dss.copy_payload(relay, buffer);
}
@ -430,6 +436,7 @@ static void xcast_recv(int status, orte_process_name_t* sender,
OPAL_OUTPUT_VERBOSE((5, orte_grpcomm_base_framework.framework_output,
"%s grpcomm:direct:send_relay - recipient list is empty!",
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)));
OBJ_RELEASE(rly);
goto CLEANUP;
}

Просмотреть файл

@ -8,6 +8,8 @@
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Mellanox Technologies, Inc.
* All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -333,5 +335,7 @@ static int rcd_finalize_coll(orte_grpcomm_coll_t *coll, int ret) {
OBJ_RELEASE(reply);
OBJ_RELEASE(coll);
return ORTE_SUCCESS;
}

Просмотреть файл

@ -307,8 +307,10 @@ static int usock_peer_send_connect_ack(mca_oob_usock_peer_t* peer)
if (ORTE_SUCCESS != usock_peer_send_blocking(peer, peer->sd, msg, sdsize)) {
ORTE_ERROR_LOG(ORTE_ERR_UNREACH);
free(msg);
return ORTE_ERR_UNREACH;
}
free(msg);
return ORTE_SUCCESS;
}

Просмотреть файл

@ -389,7 +389,6 @@ void pmix_server_finalize(void)
NULL != item;
item = opal_list_remove_first(&meta_segments)) {
attr = (opal_dstore_attr_t*) item;
free(attr->connection_info);
OBJ_RELEASE(attr);
}
OPAL_LIST_DESTRUCT(&meta_segments);

Просмотреть файл

@ -120,8 +120,10 @@ int pmix_server_send_connect_ack(pmix_server_peer_t* peer)
if (ORTE_SUCCESS != usock_peer_send_blocking(peer, peer->sd, msg, sdsize)) {
ORTE_ERROR_LOG(ORTE_ERR_UNREACH);
free(msg);
return ORTE_ERR_UNREACH;
}
free(msg);
return ORTE_SUCCESS;
}

Просмотреть файл

@ -310,7 +310,7 @@ static int read_bytes(pmix_server_peer_t* peer)
//if (NULL != pmix_server.oob_exception_callback) {
// pmix_server.oob_exception_callback(&peer->peer_name, ORTE_RML_PEER_DISCONNECTED);
//}
return ORTE_ERR_WOULD_BLOCK;
return ORTE_ERR_PEER_CLOSED;
}
/* we were able to read something, so adjust counters and location */
peer->recv_msg->rdbytes -= rc;
@ -486,15 +486,18 @@ static int stuff_proc_values(opal_buffer_t *reply, orte_job_t *jdata, orte_proc_
/* add the name of the proc */
if (OPAL_SUCCESS != (rc = opal_dss.pack(&buf, &pptr->name, 1, OPAL_NAME))) {
ORTE_ERROR_LOG(rc);
free(tmp);
opal_argv_free(list);
return rc;
}
/* add its cpuset */
if (OPAL_SUCCESS != (rc = opal_dss.pack(&buf, &tmp, 1, OPAL_STRING))) {
ORTE_ERROR_LOG(rc);
free(tmp);
opal_argv_free(list);
return rc;
}
free(tmp);
}
}
}
@ -1095,6 +1098,7 @@ static void process_message(pmix_server_peer_t *peer)
orte_rml.send_buffer_nb(ORTE_PROC_MY_NAME, reply,
ORTE_RML_TAG_DAEMON_COLL,
orte_rml_send_callback, NULL);
OBJ_DESTRUCT(&xfer);
return;
reply_fence:
if (PMIX_FENCE_CMD == cmd) {
@ -1156,6 +1160,7 @@ static void process_message(pmix_server_peer_t *peer)
/* pack the error status */
if (OPAL_SUCCESS != (rc = opal_dss.pack(reply, &ret, 1, OPAL_INT))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&xfer);
OBJ_RELEASE(reply);
return;
}
@ -1163,10 +1168,12 @@ static void process_message(pmix_server_peer_t *peer)
rc = pack_segment_info(idreq, reply);
if (OPAL_SUCCESS != rc) {
OPAL_ERROR_LOG(rc);
OBJ_DESTRUCT(&xfer);
OBJ_RELEASE(reply);
return;
}
PMIX_SERVER_QUEUE_SEND(peer, tag, reply);
OBJ_DESTRUCT(&xfer);
return;
}
/* if we have not yet received data for this proc, then we just
@ -1201,10 +1208,12 @@ static void process_message(pmix_server_peer_t *peer)
ret = ORTE_ERR_NOT_FOUND;
if (OPAL_SUCCESS != (rc = opal_dss.pack(reply, &ret, 1, OPAL_INT))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&xfer);
OBJ_RELEASE(reply);
return;
}
PMIX_SERVER_QUEUE_SEND(peer, tag, reply);
OBJ_DESTRUCT(&xfer);
return;
}
/* setup the request */
@ -1212,6 +1221,7 @@ static void process_message(pmix_server_peer_t *peer)
/* pack the proc we want info about */
if (OPAL_SUCCESS != (rc = opal_dss.pack(reply, &idreq, 1, OPAL_NAME))) {
ORTE_ERROR_LOG(rc);
OBJ_DESTRUCT(&xfer);
return;
}
/* send the request - the recv will come back elsewhere
@ -1222,6 +1232,7 @@ static void process_message(pmix_server_peer_t *peer)
}
}
/* nothing further to do as we are waiting for data */
OBJ_DESTRUCT(&xfer);
return;
}

Просмотреть файл

@ -14,6 +14,8 @@
* Copyright (c) 2011-2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2013-2014 Intel, Inc. All rights reserved
* Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -915,6 +917,8 @@ static void orte_attr_des(orte_attribute_t *p)
}
} else if (OPAL_BUFFER == p->type) {
OBJ_DESTRUCT(&p->data.buf);
} else if (OPAL_STRING == p->type) {
free(p->data.string);
}
}
OBJ_CLASS_INSTANCE(orte_attribute_t,