Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI : add leak detection.
[simgrid.git] / src / smpi / mpi / smpi_comm.cpp
index e1cf7e6..5bcb35e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -34,6 +34,8 @@ Comm::Comm(MPI_Group group, MPI_Topology topo, bool smp, int in_id)
   errhandler_->ref();
   //First creation of comm is done before SIMIX_run, so only do comms for others
   if(in_id==MPI_UNDEFINED && smp==0 && this->rank()!=MPI_UNDEFINED ){
+    this->add_f();
+    group->add_f();
     int id;
     if(this->rank()==0){
       static int global_id_ = 0;
@@ -322,6 +324,8 @@ void Comm::unref(Comm* comm){
   Group::unref(comm->group_);
 
   if(comm->refcount_==0){
+    if(simgrid::smpi::F2C::lookup() != nullptr)
+      F2C::free_f(comm->c2f());
     comm->cleanup_smp();
     comm->cleanup_attr<Comm>();
     if (comm->info_ != MPI_INFO_NULL)