Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Memory leak--
[simgrid.git] / src / smpi / internals / instr_smpi.cpp
index 4d3ab5a..30b9bf1 100644 (file)
@@ -74,7 +74,9 @@ static std::map<std::string, std::string> smpi_colors = {{"recv", "1 0 0"},
   {"win_flush", "1 0 0.3"},
   {"win_flush_local", "1 0 0.8"},
   {"win_flush_all", "1 0.8 0"},
-  {"win_flush_local_all", "1 0 0.3"}
+  {"win_flush_local_all", "1 0 0.3"},
+  
+  {"file_read", "1 1 0.3"}
 };
 
 static const char* instr_find_color(const char* c_state)
@@ -149,7 +151,10 @@ void TRACE_smpi_init(int rank)
   if (not TRACE_smpi_is_enabled())
     return;
 
+  auto self = simgrid::s4u::Actor::self();
+
   TRACE_smpi_setup_container(rank, sg_host_self());
+  simgrid::s4u::this_actor::on_exit([self](bool) { smpi_container(self->get_pid())->remove_from_parent(); });
 #if HAVE_PAPI
   container_t container   = smpi_container(rank);
   papi_counter_t counters = smpi_process()->papi_counters();
@@ -164,14 +169,6 @@ void TRACE_smpi_init(int rank)
 #endif
 }
 
-void TRACE_smpi_finalize(int rank)
-{
-  if (not TRACE_smpi_is_enabled())
-    return;
-
-  smpi_container(rank)->remove_from_parent();
-}
-
 void TRACE_smpi_computing_init(int rank)
 {
  //first use, initialize the color in the trace