Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [OMPI users] Uncommitted MPI_Datatype leaks memory heavily
From: George Bosilca (bosilca_at_[hidden])
Date: 2012-05-13 14:31:37


Get the free out of the #ifndef LEAK and your problem will be solved.

  george.

On May 13, 2012, at 11:18 , Ilja Honkonen wrote:

> Hello
>
> The following program leaks memory if compiled with -DLEAK (uses about 7 GB in the end but less than 20 MB without -DLEAK).
>
>
> #include "assert.h"
> #include "mpi.h"
>
> int main(int argc, char* argv[]) {
> assert(MPI_Init(&argc, &argv) == MPI_SUCCESS);
>
> for (int i = 0; i < 10000000; i++) {
> MPI_Datatype type;
> assert(
> MPI_Type_contiguous(
> 10 * sizeof(double),
> MPI_BYTE,
> &type
> ) == MPI_SUCCESS
> );
>
> #ifndef LEAK
> assert(MPI_Type_commit(&type) == MPI_SUCCESS);
> assert(MPI_Type_free(&type) == MPI_SUCCESS);
> #endif
> }
>
> assert(MPI_Finalize() == MPI_SUCCESS);
> }
>
> Since uncommitted datatypes can be used for creating new ones (MPI-2.2) this behavior seems like a rather nasty bug.
>
> mpirun --version
> mpirun (Open MPI) 1.5.5
>
> openmpi compiled with gcc (GCC) 4.5.2
> above program compiled and ran with
> mpicc -DLEAK -O3 leak.c -std=c99 && mpirun -np 1 ./a.out
> on a single AMD Phenom(tm) II X6 1075T processor. Same thing happens when compiling with mpic++.
>
> I can't use memchecker because then mpirun segfaults and even
> ompi_info | grep memchecker
> segfaults after printing MCA memchecker: valgrind (...
>
> Thanks.
> Ilja
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users