From 343ad076a31991619bc171590bd4355cf3fba33a Mon Sep 17 00:00:00 2001 From: Rob Latham Date: Mon, 7 Oct 2013 09:12:20 -0500 Subject: [PATCH] clean up MPI resources IOR was leaking a hint structure in MPI-IO case, two groups in common code, and when we get the info member from the file we were losing our reference to the hints we just passed in. --- src/aiori-MPIIO.c | 4 ++++ src/ior.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/aiori-MPIIO.c b/src/aiori-MPIIO.c index 3253ef7..ae7de20 100755 --- a/src/aiori-MPIIO.c +++ b/src/aiori-MPIIO.c @@ -146,6 +146,8 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) /* show hints actually attached to file handle */ if (rank == 0 && param->showHints) { + if (mpiHints != MPI_INFO_NULL) + MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); MPI_CHECK(MPI_File_get_info(*fd, &mpiHints), "cannot get file info"); fprintf(stdout, "\nhints returned from opened file {\n"); @@ -206,6 +208,8 @@ static void *MPIIO_Open(char *testFileName, IOR_param_t * param) (MPI_Info) MPI_INFO_NULL), "cannot set file view"); } + if (mpiHints != MPI_INFO_NULL) + MPI_CHECK(MPI_Info_free(&mpiHints), "MPI_Info_free failed"); return ((void *)fd); } diff --git a/src/ior.c b/src/ior.c index d4533d7..65194fb 100755 --- a/src/ior.c +++ b/src/ior.c @@ -2046,6 +2046,8 @@ static void TestIoSys(IOR_test_t *test) "MPI_Group_range_incl() error"); MPI_CHECK(MPI_Comm_create(MPI_COMM_WORLD, new_group, &testComm), "MPI_Comm_create() error"); + MPI_CHECK(MPI_Group_free(&orig_group), "MPI_Group_Free() error"); + MPI_CHECK(MPI_Group_free(&new_group), "MPI_Group_Free() error"); params->testComm = testComm; if (testComm == MPI_COMM_NULL) { /* tasks not in the group do not participate in this test */