From d32802daef92102fa39e9589a8a3f050b9174d70 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Tue, 16 May 2017 20:19:26 +0200 Subject: [PATCH] plug some memleaks in the new unit test --- src/surf/trace_mgr.cpp | 1 + src/surf/trace_mgr_test.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/surf/trace_mgr.cpp b/src/surf/trace_mgr.cpp index d8ea885173..7fc1da17db 100644 --- a/src/surf/trace_mgr.cpp +++ b/src/surf/trace_mgr.cpp @@ -182,6 +182,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) diff --git a/src/surf/trace_mgr_test.cpp b/src/surf/trace_mgr_test.cpp index c498ee60cd..30b261ef57 100644 --- a/src/surf/trace_mgr_test.cpp +++ b/src/surf/trace_mgr_test.cpp @@ -29,6 +29,7 @@ public: void apply_event(tmgr_trace_event_t event, double value) { XBT_VERB("t=%.1f: Change value to %lg (idx: %d)", thedate, value, event->idx); + tmgr_trace_event_unref(&event); } bool isUsed() { return true; } }; @@ -61,6 +62,7 @@ static void trace2vector(const char* str, std::vector* whereto XBT_DEBUG("%.1f: ignore an event (idx: %d)\n", thedate, it->idx); } } + tmgr_finalize(); } /* Fails in a way that is difficult to test: xbt_assert should become throw -- 2.20.1