Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
try to plug a memleak
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 2 Feb 2018 21:52:51 +0000 (22:52 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 2 Feb 2018 21:52:51 +0000 (22:52 +0100)
include/simgrid/s4u/Actor.hpp
src/s4u/s4u_actor.cpp
src/simix/ActorImpl.cpp
src/smpi/internals/smpi_global.cpp

index 670f502..147f538 100644 (file)
@@ -165,6 +165,8 @@ public:
 
   /** Signal to others that a new actor has been created **/
   static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> onCreation;
+  /** Signal indicating that the given actor is about to disappear */
+  static simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> onDestruction;
 
   /** Create an actor using a function
    *
index 5e07894..a81f54a 100644 (file)
@@ -22,6 +22,7 @@ namespace simgrid {
 namespace s4u {
 
 simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::onCreation;
+simgrid::xbt::signal<void(simgrid::s4u::ActorPtr)> s4u::Actor::onDestruction;
 
 // ***** Actor creation *****
 ActorPtr Actor::self()
index 935ca1b..5d347f1 100644 (file)
@@ -462,6 +462,7 @@ void SIMIX_process_kill(smx_actor_t process, smx_actor_t issuer) {
     return;
   }
 
+  simgrid::s4u::Actor::onDestruction(process->iface());
   XBT_DEBUG("Killing process %s@%s", process->getCname(), process->host->getCname());
 
   process->context->iwannadie = 1;
index a161b19..5aade55 100644 (file)
@@ -628,6 +628,11 @@ void SMPI_init(){
   simgrid::s4u::Actor::onCreation.connect([](simgrid::s4u::ActorPtr actor) {
     smpi_add_process(actor);
   });
+  simgrid::s4u::Actor::onDestruction.connect([](simgrid::s4u::ActorPtr actor) {
+    delete process_data.at(actor);
+    process_data.erase(actor);
+  });
+
   smpi_init_options();
   smpi_global_init();
   smpi_check_options();