Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
prepare transition of context_factory: make it private
[simgrid.git] / src / kernel / EngineImpl.cpp
index 3cb1155..6b10f2a 100644 (file)
@@ -6,6 +6,7 @@
 #include "src/kernel/EngineImpl.hpp"
 #include "mc/mc.h"
 #include "simgrid/Exception.hpp"
+#include "simgrid/kernel/Timer.hpp"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/kernel/routing/NetZoneImpl.hpp"
 #include "simgrid/s4u/Host.hpp"
@@ -15,6 +16,7 @@
 #include "src/mc/mc_record.hpp"
 #include "src/mc/mc_replay.hpp"
 #include "src/simix/smx_private.hpp"
+#include "src/smpi/include/smpi_actor.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/xml/platf.hpp" // FIXME: KILLME. There must be a better way than mimicking XML here
 
@@ -27,6 +29,12 @@ config::Flag<double> cfg_breakpoint{"debug/breakpoint",
                                     "When non-negative, raise a SIGTRAP after given (simulated) time", -1.0};
 EngineImpl::~EngineImpl()
 {
+
+  while (not timer::kernel_timers().empty()) {
+    delete timer::kernel_timers().top().second;
+    timer::kernel_timers().pop();
+  }
+
   /* Since hosts_ is a std::map, the hosts are destroyed in the lexicographic order, which ensures that the output is
    * reproducible.
    */
@@ -42,7 +50,10 @@ EngineImpl::~EngineImpl()
     if (kv.second)
       kv.second->destroy();
 
-      /* Free the remaining data structures */
+  for (auto const& kv : mailboxes_)
+    delete kv.second;
+
+    /* Free the remaining data structures */
 #if SIMGRID_HAVE_MC
   xbt_dynar_free(&actors_vector_);
   xbt_dynar_free(&dead_actors_vector_);
@@ -111,7 +122,7 @@ void EngineImpl::wake_all_waiting_actors() const
  */
 void EngineImpl::run_all_actors()
 {
-  simix_global->context_factory->run_all();
+  simix_global->get_context_factory()->run_all();
 
   actors_to_run_.swap(actors_that_ran_);
   actors_to_run_.clear();