1
1

Based on the patch submitted by Pascal Deveze, here is the memory leak fix

for the type indexed creation.

CMR v1.4 and v1.5.

This commit was SVN r24617.
Этот коммит содержится в:
George Bosilca 2011-04-14 21:50:06 +00:00
родитель 3a28556472
Коммит 971711474f

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

@ -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-2010 The University of Tennessee and The University
* of Tennessee Research Foundation. All rights
* reserved.
* Copyright (c) 2004-2006 High Performance Computing Center Stuttgart,
@ -46,26 +46,21 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const
dLength = pBlockLength[0];
endat = disp + dLength;
ompi_datatype_type_extent( oldType, &extent );
if( 1 >= count ) {
pdt = ompi_datatype_create( oldType->super.desc.used + 2 );
/* multiply by count to make it zero if count is zero */
ompi_datatype_add( pdt, oldType, count * dLength, disp * extent, extent );
} else {
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) );
for( i = 1; i < count; i++ ) {
if( endat == pDisp[i] ) {
/* contiguous with the previsious */
dLength += pBlockLength[i];
endat += pBlockLength[i];
} else {
ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent );
disp = pDisp[i];
dLength = pBlockLength[i];
endat = disp + pBlockLength[i];
}
pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) );
for( i = 1; i < count; i++ ) {
if( endat == pDisp[i] ) {
/* contiguous with the previsious */
dLength += pBlockLength[i];
endat += pBlockLength[i];
} else {
ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent );
disp = pDisp[i];
dLength = pBlockLength[i];
endat = disp + pBlockLength[i];
}
ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent );
}
ompi_datatype_add( pdt, oldType, dLength, disp * extent, extent );
*newType = pdt;
return OMPI_SUCCESS;
@ -91,25 +86,20 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const
dLength = pBlockLength[0];
endat = disp + dLength * extent;
if( 1 >= count ) {
pdt = ompi_datatype_create( oldType->super.desc.used + 2 );
/* multiply by count to make it zero if count is zero */
ompi_datatype_add( pdt, oldType, count * dLength, disp, extent );
} else {
for( i = 1; i < count; i++ ) {
if( endat == pDisp[i] ) {
/* contiguous with the previsious */
dLength += pBlockLength[i];
endat += pBlockLength[i] * extent;
} else {
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
disp = pDisp[i];
dLength = pBlockLength[i];
endat = disp + pBlockLength[i] * extent;
}
for( i = 1; i < count; i++ ) {
if( endat == pDisp[i] ) {
/* contiguous with the previsious */
dLength += pBlockLength[i];
endat += pBlockLength[i] * extent;
} else {
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
disp = pDisp[i];
dLength = pBlockLength[i];
endat = disp + pBlockLength[i] * extent;
}
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
}
ompi_datatype_add( pdt, oldType, dLength, disp, extent );
*newType = pdt;
return OMPI_SUCCESS;
}