1
1

Correctly initialize and finalize all the datatype classes. No memory leaks on the

datatype engine subsists.

This commit was SVN r30019.
Этот коммит содержится в:
George Bosilca 2013-12-20 15:57:10 +00:00
родитель a85194ae96
Коммит 7178492dd5
3 изменённых файлов: 21 добавлений и 18 удалений

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

@ -452,6 +452,8 @@ int32_t ompi_datatype_init( void )
{
int32_t i;
opal_datatype_init();
/* Create the f2c translation table */
OBJ_CONSTRUCT(&ompi_datatype_f_to_c_table, opal_pointer_array_t);
if( OPAL_SUCCESS != opal_pointer_array_init(&ompi_datatype_f_to_c_table,
@ -623,7 +625,7 @@ int32_t ompi_datatype_init( void )
/**
* Now make sure all non-contiguous types are marked as such.
*/
for( i = 0; i < ompi_mpi_offset.dt.d_f_to_c_index; i++ ) {
for( i = 0; i < ompi_mpi_count.dt.d_f_to_c_index; i++ ) {
opal_datatype_t* datatype = (opal_datatype_t*)opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, i );
if( (datatype->ub - datatype->lb) == (OPAL_PTRDIFF_TYPE)datatype->size ) {
@ -632,7 +634,6 @@ int32_t ompi_datatype_init( void )
datatype->flags &= ~OPAL_DATATYPE_FLAG_NO_GAPS;
}
}
ompi_datatype_default_convertors_init();
return OMPI_SUCCESS;
}
@ -645,15 +646,12 @@ int32_t ompi_datatype_finalize( void )
*/
/* As they are statically allocated they cannot be released.
* XXX But we can call OBJ_DESTRUCT, just to free all internally allocated ressources.
* But we can call OBJ_DESTRUCT, just to free all internally allocated ressources.
*/
#if 0
int i;
for( i = 0; i < OMPI_DATATYPE_MAX_PREDEFINED; i++ ) {
OBJ_DESTRUCT( ompi_datatype_basicDatatypes[i] );
for( int i = 0; i < ompi_mpi_count.dt.d_f_to_c_index; i++ ) {
opal_datatype_t* datatype = (opal_datatype_t*)opal_pointer_array_get_item(&ompi_datatype_f_to_c_table, i );
OBJ_DESTRUCT(datatype);
}
#endif /* 0 */
/* Get rid of the Fortran2C translation table */
OBJ_DESTRUCT(&ompi_datatype_f_to_c_table);

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

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2009 The University of Tennessee and The University
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -60,13 +60,13 @@ static void opal_datatype_destruct( opal_datatype_t* datatype )
datatype->desc.length = 0;
datatype->desc.used = 0;
}
if( datatype->opt_desc.desc != NULL ) {
if( datatype->opt_desc.desc != datatype->desc.desc )
free( datatype->opt_desc.desc );
datatype->opt_desc.length = 0;
datatype->opt_desc.used = 0;
datatype->opt_desc.desc = NULL;
}
}
if( datatype->opt_desc.desc != NULL ) {
if( datatype->opt_desc.desc != datatype->desc.desc )
free( datatype->opt_desc.desc );
datatype->opt_desc.length = 0;
datatype->opt_desc.used = 0;
datatype->opt_desc.desc = NULL;
}
/**
* As the default description and the optimized description can point to the

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

@ -3,7 +3,7 @@
* Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* Copyright (c) 2004-2010 The University of Tennessee and The University
* Copyright (c) 2004-2013 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -198,6 +198,11 @@ int32_t opal_datatype_init( void )
const opal_datatype_t* datatype;
int32_t i;
/**
* Force he initialization of the opal_datatype_t class. This will allow us to
* call OBJ_DESTRUCT without going too deep in the initialization process.
*/
opal_class_initialize(OBJ_CLASS(opal_datatype_t));
for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) {
datatype = opal_datatype_basicDatatypes[i];