Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
plug leaks
[simgrid.git] / src / surf / trace_mgr.cpp
index d8ea885..f100e2e 100644 (file)
@@ -1,11 +1,10 @@
-/* Copyright (c) 2004-2005, 2007, 2009-2014. The SimGrid Team.
+/* Copyright (c) 2004-2005, 2007, 2009-2014, 2016-2017. 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. */
 
 #include "xbt/sysdep.h"
-#include "xbt/dict.h"
 #include "xbt/log.h"
 #include "xbt/str.h"
 
@@ -16,8 +15,8 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/join.hpp>
 #include <boost/algorithm/string/split.hpp>
+#include <cmath>
 #include <fstream>
-#include <math.h>
 #include <sstream>
 #include <unordered_map>
 
@@ -110,7 +109,7 @@ tmgr_trace_t tmgr_trace_new_from_file(const char *filename)
   xbt_assert(trace_list.find(filename) == trace_list.end(), "Refusing to define trace %s twice", filename);
 
   std::ifstream* f = surf_ifsopen(filename);
-  xbt_assert(!f->fail(), "Cannot open file '%s' (path=%s)", filename, (boost::join(surf_path, ":")).c_str());
+  xbt_assert(not f->fail(), "Cannot open file '%s' (path=%s)", filename, (boost::join(surf_path, ":")).c_str());
 
   std::stringstream buffer;
   buffer << f->rdbuf();
@@ -182,6 +181,7 @@ void tmgr_finalize()
     xbt_free((char*)kv.first);
     delete kv.second;
   }
+  trace_list.clear();
 }
 
 void tmgr_trace_event_unref(tmgr_trace_event_t* trace_event)