Hello,

I appear to have found a memory leak in OpenMPI, using the following
simple program (memory_leak_check_minimal.C):

#include <mpi.h>

int main(void)
{
  int i=0;
  MPI_Init(&i, NULL);

  char* result;
  for(size_t i=0 ; i < 10000 ; i++)
  {
    MPI_Alloc_mem(100, MPI_INFO_NULL, &result);
    MPI_Free_mem(result);
  }
  MPI_Finalize();
}

OpenMPI versions: 3.0.0 and 2.1.2 exhibit the leak, 1.10.7 does not.
Platform: Ubuntu 16.04
Compiler: gcc-5.4.0 (default as on Ubuntu 16.04)
Configure flags:
./configure --prefix=/local/data/public/pmblakely/openmpi-3.0.0-install

Compilation:
/local/data/public/pmblakely/openmpi-3.0.0-install/bin/mpicc
./memory_leak_check_minimal.C -o ./memory_leak_check_minimal-3.0.0 -g
-O0
Testing:
valgrind --tool=massif --threshold=0.1 --detailed-freq=1
./memory_leak_check_minimal-3.0.0
Then, ms_print --threshold=0.1 ./massif.out shows:
->62.52% (1,615,768B) 0x59F6D75: opal_free_list_grow_st (in
/local/data/public/pmblakely/openmpi-3.0.0-install/lib/libopen-pal.so.40.0.0)
near the beginning, and
->80.07% (4,312,304B) 0x59F6D75: opal_free_list_grow_st (in
/local/data/public/pmblakely/openmpi-3.0.0-install/lib/libopen-pal.so.40.0.0)
near the end of the test-run (the final mentions of
opal_free_list_grow_st show that the memory is eventually freed, but
probably by MPI_Finalize()).

Please could someone either confirm that this is an actual memory
leak, or let me know what options or extra MPI calls I should be using
to avoid this and ensure the memory is actually freed?

Let me know if more diagnostic information is required.

Kind regards,

Philip
_______________________________________________
users mailing list
users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/users

Reply via email to