Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
that didn't work as intended
[simgrid.git] / src / smpi / internals / smpi_global.cpp
index ceda03f..ab98ec2 100644 (file)
@@ -639,15 +639,17 @@ void SMPI_finalize()
     if (simgrid::smpi::F2C::lookup()->size() > simgrid::smpi::F2C::get_num_default_handles()){
       XBT_WARN("Probable Leaks in your code: SMPI detected %zu unfreed MPI handles : "
                "display types and addresses (n max) with --cfg=smpi/list-leaks:n.\n"
-               "Running smpirun with -wrapper \"valgrind --leak-check=full\" can provide more information", 
+               "Running smpirun with -wrapper \"valgrind --leak-check=full\" can provide more information",
                simgrid::smpi::F2C::lookup()->size() - simgrid::smpi::F2C::get_num_default_handles());
       int n = simgrid::config::get_value<int>("smpi/list-leaks");
       if (n > 0) {
         std::for_each(simgrid::smpi::F2C::lookup()->begin(),
                   simgrid::smpi::F2C::lookup()->end(),
                   [n](const std::pair<unsigned int, simgrid::smpi::F2C*> &p) {
-                      if(p.first >= simgrid::smpi::F2C::get_num_default_handles() && p.first < simgrid::smpi::F2C::get_num_default_handles() + n) 
+                      static int printed = 0;
+                      if(p.first >= simgrid::smpi::F2C::get_num_default_handles() && printed < n)
                         XBT_WARN ("Leak %p of type %s", p.second, boost::core::demangle(typeid(*(p.second)).name()).c_str() );
+                        printed++;
                   });
       }
     }