all_gather generates a memory leak
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
Change History
(5)
Owner: |
changed from Douglas Gregor to Matthias Troyer
|
Severity: |
Problem → Cosmetic
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
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.