Opened 14 years ago

Closed 13 years ago

#2586 closed Bugs (fixed)

all_gather generates a memory leak

Reported by: micdestefano@… Owned by: Matthias Troyer
Milestone: Boost 1.38.0 Component: mpi
Version: Boost 1.36.0 Severity: Cosmetic
Keywords: MPI all_gather valgrind still reachable Cc: Matthias Troyer

Description

Running valgrind on the attached sample program with the command below

mpiexec -n 2 valgrind --leak-check=full --show-reachable=yes ./test_all_gather

gives the errors reported into the attached "valgrind_out.txt" file.

I've found this error on a Linux CentOS 5, 32 bit machine, with mpich2-1.0.6p1 and Boost 1.36.0.

I noticed that if you change the data type of the gathered pair into std::pair<int,int> (and, obviously, the corresponding data-type of the output vector), the leak disappears. So may be the error is generated by the usage of the size_t data type. I don't know if it is linked to the usage of the std::pair or not.

Before submitting this ticket I've done a search on "all_gather still reachable", but I did not find anything. Furthermore, I've seen that there is not any update in Boost MPI between releases 1.36.0 and 1.37.0. So, I reported.


Thank you in advance
Best Regards
Michele De Stefano

Attachments (2)

test_all_gather.cpp (491 bytes ) - added by anonymous 14 years ago.
valgrind_out.txt (21.7 KB ) - added by anonymous 14 years ago.

Download all attachments as: .zip

Change History (5)

by anonymous, 14 years ago

Attachment: test_all_gather.cpp added

by anonymous, 14 years ago

Attachment: valgrind_out.txt added

comment:1 by anonymous, 14 years ago

Owner: changed from Douglas Gregor to Matthias Troyer
Severity: ProblemCosmetic

This is a minor issue. Boost.MPI creates a global map of MPI Datatypes used that are cached until the end of execution. They cannot be released at the end of program execution when the map is destroyed, since at that time MPI is no longer initialized. Since at that point in time a memory leak is irrelevant this is an acceptable decision.

However, it causes this warning when users check their code by valgrind. Note that it will appear anytime you use a custom MPI datatype anywhere, not just when using all_reduce.

We can still fix it in the next release, at the cost of slightly slower finalization of MPI.

comment:2 by micdestefano@…, 14 years ago

Ok. I didn't know if it was a serious problem or not. So, I simply reported.
If it does not prevent the normal execution of any program, for me it's OK.

Thank you very much.
Best Regards
Michele De Stefano

comment:3 by Matthias Troyer, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.