From: Augustin Degomme Date: Thu, 18 Apr 2019 19:47:41 +0000 (+0200) Subject: be cleaner with memory X-Git-Tag: v3.22.2~98 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/dcb9ba7d72e38cec362d4b04179eeb5e89635aca be cleaner with memory --- diff --git a/src/smpi/include/smpi_file.hpp b/src/smpi/include/smpi_file.hpp index 72efd93580..fa3b505125 100644 --- a/src/smpi/include/smpi_file.hpp +++ b/src/smpi/include/smpi_file.hpp @@ -151,7 +151,7 @@ class File{ } XBT_DEBUG("will have to access %lld from my chunk", totreads); - char* sendbuf= static_cast(smpi_get_tmp_sendbuffer(totreads)); + char* sendbuf= static_cast(smpi_get_tmp_sendbuffer(total_sent)); if(totreads>0){ seek(min_offset, MPI_SEEK_SET); diff --git a/teshsuite/smpi/io-all/io-all.c b/teshsuite/smpi/io-all/io-all.c index 56d95b3b27..0f97937747 100644 --- a/teshsuite/smpi/io-all/io-all.c +++ b/teshsuite/smpi/io-all/io-all.c @@ -20,7 +20,7 @@ int main( int argc, char *argv[] ) MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); MPI_Comm_size( comm, &size ); MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10+ size * sizeof(int) ); + buf = (int *)malloc( 10 * sizeof(int) ); buf[0] = rank; /* Write to file */ diff --git a/teshsuite/smpi/io-ordered/io-ordered.c b/teshsuite/smpi/io-ordered/io-ordered.c index e5225dfbbd..7fae204439 100644 --- a/teshsuite/smpi/io-ordered/io-ordered.c +++ b/teshsuite/smpi/io-ordered/io-ordered.c @@ -20,7 +20,7 @@ int main( int argc, char *argv[] ) MPI_File_open( comm, (char*)"/scratch/lib/libsimgrid.so.3.6.2", MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, MPI_INFO_NULL, &fh ); MPI_Comm_size( comm, &size ); MPI_Comm_rank( comm, &rank ); - buf = (int *)malloc( 10+size * sizeof(int) ); + buf = (int *)malloc( 10* sizeof(int) ); buf[0] = rank; /* Write to file */