Fix a memory leak in mca/pml/bfo
Allocate the allocator in init rather than open cmr=v1.8.2:reviewer=rhc This commit was SVN r31816.
Этот коммит содержится в:
родитель
8bafe06c57
Коммит
c82a6f5063
@ -12,6 +12,8 @@
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
* Additional copyrights may follow
|
||||
@ -149,25 +151,9 @@ static int mca_pml_bfo_component_register(void)
|
||||
|
||||
static int mca_pml_bfo_component_open(void)
|
||||
{
|
||||
mca_allocator_base_component_t* allocator_component;
|
||||
|
||||
mca_pml_bfo_output = opal_output_open(NULL);
|
||||
opal_output_set_verbosity(mca_pml_bfo_output, mca_pml_bfo_verbose);
|
||||
|
||||
allocator_component = mca_allocator_component_lookup( mca_pml_bfo.allocator_name );
|
||||
if(NULL == allocator_component) {
|
||||
opal_output(0, "mca_pml_bfo_component_open: can't find allocator: %s\n", mca_pml_bfo.allocator_name);
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
mca_pml_bfo.allocator = allocator_component->allocator_init(true,
|
||||
mca_pml_bfo_seg_alloc,
|
||||
mca_pml_bfo_seg_free, NULL);
|
||||
if(NULL == mca_pml_bfo.allocator) {
|
||||
opal_output(0, "mca_pml_bfo_component_open: unable to initialize allocator\n");
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
mca_pml_bfo.enabled = false;
|
||||
return mca_base_framework_open(&ompi_bml_base_framework, 0);
|
||||
}
|
||||
@ -191,6 +177,8 @@ mca_pml_bfo_component_init( int* priority,
|
||||
bool enable_progress_threads,
|
||||
bool enable_mpi_threads )
|
||||
{
|
||||
mca_allocator_base_component_t* allocator_component;
|
||||
|
||||
opal_output_verbose( 10, mca_pml_bfo_output,
|
||||
"in bfo, my priority is %d\n", mca_pml_bfo.priority);
|
||||
|
||||
@ -200,6 +188,21 @@ mca_pml_bfo_component_init( int* priority,
|
||||
}
|
||||
*priority = mca_pml_bfo.priority;
|
||||
|
||||
allocator_component = mca_allocator_component_lookup( mca_pml_bfo.allocator_name );
|
||||
if(NULL == allocator_component) {
|
||||
opal_output(0, "mca_pml_bfo_component_open: can't find allocator: %s\n", mca_pml_bfo.allocator_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mca_pml_bfo.allocator = allocator_component->allocator_init(true,
|
||||
mca_pml_bfo_seg_alloc,
|
||||
mca_pml_bfo_seg_free, NULL);
|
||||
if(NULL == mca_pml_bfo.allocator) {
|
||||
opal_output(0, "mca_pml_bfo_component_open: unable to initialize allocator\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if(OMPI_SUCCESS != mca_bml_base_init( enable_progress_threads,
|
||||
enable_mpi_threads)) {
|
||||
return NULL;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user