Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix memleaks with MPI_*_get_info, when info is duplicated.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 8 Jun 2021 12:11:50 +0000 (14:11 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 8 Jun 2021 12:33:51 +0000 (14:33 +0200)
src/smpi/include/smpi_info.hpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_file.cpp
src/smpi/mpi/smpi_info.cpp
src/smpi/mpi/smpi_win.cpp

index d655edc..252cd87 100644 (file)
@@ -21,7 +21,7 @@ class Info : public F2C{
 
 public:
   explicit Info() {this->add_f();}
-  explicit Info(const Info* orig) : map_(orig->map_) {this->add_f();}
+  explicit Info(const Info* orig);
   void ref();
   static void unref(MPI_Info info);
   void set(const char* key, const char* value) { map_[key] = value; }
index 452439f..017d010 100644 (file)
@@ -564,9 +564,6 @@ void Comm::finish_rma_calls() const
 
 MPI_Info Comm::info()
 {
-  if (info_ == MPI_INFO_NULL)
-    info_ = new Info();
-  info_->ref();
   return info_;
 }
 
index 9dc8f69..4ad8f8f 100644 (file)
@@ -301,9 +301,6 @@ namespace smpi{
 
   MPI_Info File::info()
   {
-    if (info_ == MPI_INFO_NULL)
-      info_ = new Info();
-    info_->ref();
     return info_;
   }
 
index 33be519..f979b75 100644 (file)
 namespace simgrid {
 namespace smpi {
 
+Info::Info(const Info* orig)
+{
+  if (orig != nullptr)
+    map_ = orig->map_;
+  this->add_f();
+}
+
 void Info::ref()
 {
   refcount_++;
index 216a200..38f901a 100644 (file)
@@ -130,9 +130,6 @@ void Win::get_group(MPI_Group* group){
 
 MPI_Info Win::info()
 {
-  if (info_ == MPI_INFO_NULL)
-    info_ = new Info();
-  info_->ref();
   return info_;
 }