Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix leak of memory caused by DefineEventTypeEvent call
authorTakishipp <toufik.boubehziz@gmail.com>
Mon, 19 Jun 2017 09:59:25 +0000 (11:59 +0200)
committerTakishipp <toufik.boubehziz@gmail.com>
Mon, 19 Jun 2017 09:59:25 +0000 (11:59 +0200)
src/instr/instr_paje_trace.cpp
src/instr/instr_paje_types.cpp
src/instr/instr_private.h

index 2676cd1..3a1033d 100644 (file)
@@ -273,24 +273,13 @@ if (instr_fmt_type == instr_fmt_paje) {
 }
 
 
-DefineEventTypeEvent::DefineEventTypeEvent(type_t type)
+void LogDefineEventType(type_t type)
 {
-  this->event_type                        = PAJE_DefineEventType;
-  this->timestamp                         = 0;
-  this->type = type;
-
-  XBT_DEBUG("%s: event_type=%d", __FUNCTION__, (int)event_type);
-
   //print it
-  print();
-}
-
-
-void DefineEventTypeEvent::print() {
   if (instr_fmt_type == instr_fmt_paje) {
-    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+    XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineEventType, TRACE_precision(), 0.);
     stream << std::fixed << std::setprecision(TRACE_precision());
-    stream << (int)this->event_type;
+    stream << PAJE_DefineEventType;
     stream << " " << type->id << " " << type->father->id << " " << type->name;
     print_row();
   } else if (instr_fmt_type == instr_fmt_TI) {
index 02c935c..9fd1dfe 100644 (file)
@@ -143,7 +143,7 @@ type_t PJ_type_event_new (const char *name, type_t father)
 
   type_t ret = newType (name, name, nullptr, TYPE_EVENT, father);
   XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
-  new DefineEventTypeEvent(ret);
+  LogDefineEventType(ret);
   return ret;
 }
 
index 64e6080..658663e 100644 (file)
@@ -141,13 +141,6 @@ class DefineStateTypeEvent : public PajeEvent  {
   void print() override;
 };
 
-class DefineEventTypeEvent : public PajeEvent  {
-  type_t type;
-  public:
-  DefineEventTypeEvent(type_t type);
-  void print() override;
-};
-
 
 class SetVariableEvent : public PajeEvent  {
   container_t container;
@@ -443,5 +436,6 @@ void LogLinkTypeDefinition(type_t type, type_t source, type_t dest);
 void LogEntityValue (val_t value);
 void LogContainerCreation (container_t container);
 void LogContainerDestruction (container_t container);
+void LogDefineEventType(type_t type);
 
 #endif