Some minor valgrind-inspired cleanups: fix some memory leaks.
Also took the opprotunity to convert the rdma mpool to use the MCA register function. This commit was SVN r20541.
Этот коммит содержится в:
родитель
6a1a8311cd
Коммит
c83ef674e3
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2006 Voltaire. All rights reserved.
|
||||
* Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -35,8 +35,10 @@
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
static int mca_mpool_rdma_open(void);
|
||||
static mca_mpool_base_module_t* mca_mpool_rdma_init(
|
||||
static int rdma_open(void);
|
||||
static int rdma_close(void);
|
||||
static int rdma_register(void);
|
||||
static mca_mpool_base_module_t* rdma_init(
|
||||
struct mca_mpool_base_resources_t* resources);
|
||||
|
||||
mca_mpool_rdma_component_t mca_mpool_rdma_component = {
|
||||
@ -51,22 +53,30 @@ mca_mpool_rdma_component_t mca_mpool_rdma_component = {
|
||||
OMPI_MAJOR_VERSION, /* MCA component major version */
|
||||
OMPI_MINOR_VERSION, /* MCA component minor version */
|
||||
OMPI_RELEASE_VERSION, /* MCA component release version */
|
||||
mca_mpool_rdma_open, /* component open */
|
||||
NULL
|
||||
rdma_open, /* component open */
|
||||
rdma_close,
|
||||
NULL,
|
||||
rdma_register
|
||||
},
|
||||
{
|
||||
/* The component is checkpoint ready */
|
||||
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
||||
},
|
||||
|
||||
mca_mpool_rdma_init
|
||||
rdma_init
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* component open/close/init function
|
||||
*/
|
||||
static int mca_mpool_rdma_open(void)
|
||||
static int rdma_open(void)
|
||||
{
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static int rdma_register(void)
|
||||
{
|
||||
int val;
|
||||
|
||||
@ -92,7 +102,18 @@ static int mca_mpool_rdma_open(void)
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
static mca_mpool_base_module_t* mca_mpool_rdma_init(
|
||||
|
||||
static int rdma_close(void)
|
||||
{
|
||||
if (NULL != mca_mpool_rdma_component.rcache_name) {
|
||||
free(mca_mpool_rdma_component.rcache_name);
|
||||
}
|
||||
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static mca_mpool_base_module_t* rdma_init(
|
||||
struct mca_mpool_base_resources_t *resources)
|
||||
{
|
||||
mca_mpool_rdma_module_t* mpool_module;
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -72,7 +72,7 @@ mca_mpool_sm_component_t mca_mpool_sm_component = {
|
||||
}
|
||||
};
|
||||
|
||||
static char *max_size_param, *min_size_param, *peer_size_param;
|
||||
static char *max_size_param = NULL, *min_size_param = NULL, *peer_size_param = NULL;
|
||||
static long default_max, default_min, default_peer;
|
||||
|
||||
#if SIZEOF_LONG == 4
|
||||
@ -163,6 +163,19 @@ static int mca_mpool_sm_close( void )
|
||||
}
|
||||
OBJ_RELEASE( mca_common_sm_mmap );
|
||||
}
|
||||
|
||||
if (NULL != mca_mpool_sm_component.sm_allocator_name) {
|
||||
free(mca_mpool_sm_component.sm_allocator_name);
|
||||
}
|
||||
if (NULL != max_size_param) {
|
||||
free(max_size_param);
|
||||
}
|
||||
if (NULL != min_size_param) {
|
||||
free(min_size_param);
|
||||
}
|
||||
if (NULL != peer_size_param) {
|
||||
free(peer_size_param);
|
||||
}
|
||||
return OMPI_SUCCESS;
|
||||
}
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user