about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <martin@se.inf.tu-dresden.de>2013-01-15 11:08:33 +0100
committerMartin Nowack <martin@se.inf.tu-dresden.de>2013-12-05 00:48:49 +0100
commit0675b9f7f3cd66c92d9babd1ccee2dcc47bdfafc (patch)
treeb476be2663be7241bee3b23a40024fde3982447e
parent7c415a118f1bfc291cc6f2479b78db8041db95a4 (diff)
downloadklee-0675b9f7f3cd66c92d9babd1ccee2dcc47bdfafc.tar.gz
Fix timer leak
-rw-r--r--lib/Core/Executor.cpp5
-rw-r--r--lib/Core/ExecutorTimerInfo.h42
-rw-r--r--lib/Core/ExecutorTimers.cpp20
3 files changed, 49 insertions, 18 deletions
diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp
index 6df8dd14..eadc685b 100644
--- a/lib/Core/Executor.cpp
+++ b/lib/Core/Executor.cpp
@@ -24,6 +24,7 @@
 #include "StatsTracker.h"
 #include "TimingSolver.h"
 #include "UserSearcher.h"
+#include "ExecutorTimerInfo.h"
 #include "../Solver/SolverStats.h"
 
 #include "klee/ExecutionState.h"
@@ -385,6 +386,10 @@ Executor::~Executor() {
     delete statsTracker;
   delete solver;
   delete kmodule;
+  while(!timers.empty()) {
+    delete timers.back();
+    timers.pop_back();
+  }
 }
 
 /***/
diff --git a/lib/Core/ExecutorTimerInfo.h b/lib/Core/ExecutorTimerInfo.h
new file mode 100644
index 00000000..60977b74
--- /dev/null
+++ b/lib/Core/ExecutorTimerInfo.h
@@ -0,0 +1,42 @@
+//===-- Executor.h ----------------------------------------------*- C++ -*-===//
+//
+//                     The KLEE Symbolic Virtual Machine
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Class to wrap information for a timer.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef EXECUTORTIMERINFO_H_
+#define EXECUTORTIMERINFO_H_
+
+#include "klee/Internal/System/Time.h"
+
+namespace klee {
+
+class Executor::TimerInfo {
+public:
+  Timer *timer;
+
+  /// Approximate delay per timer firing.
+  double rate;
+  /// Wall time for next firing.
+  double nextFireTime;
+
+public:
+  TimerInfo(Timer *_timer, double _rate)
+    : timer(_timer),
+      rate(_rate),
+      nextFireTime(util::getWallTime() + rate) {}
+  ~TimerInfo() { delete timer; }
+};
+
+
+}
+
+
+#endif /* EXECUTORTIMERINFO_H_ */
diff --git a/lib/Core/ExecutorTimers.cpp b/lib/Core/ExecutorTimers.cpp
index 6a5314ca..06fd4be7 100644
--- a/lib/Core/ExecutorTimers.cpp
+++ b/lib/Core/ExecutorTimers.cpp
@@ -13,6 +13,7 @@
 #include "Executor.h"
 #include "PTree.h"
 #include "StatsTracker.h"
+#include "ExecutorTimerInfo.h"
 
 #include "klee/ExecutionState.h"
 #include "klee/Internal/Module/InstructionInfoTable.h"
@@ -93,7 +94,7 @@ void Executor::initTimers() {
   }
 
   if (MaxTime) {
-    addTimer(new HaltTimer(this), MaxTime);
+    addTimer(new HaltTimer(this), MaxTime.getValue());
   }
 }
 
@@ -103,23 +104,6 @@ Executor::Timer::Timer() {}
 
 Executor::Timer::~Timer() {}
 
-class Executor::TimerInfo {
-public:
-  Timer *timer;
-  
-  /// Approximate delay per timer firing.
-  double rate;
-  /// Wall time for next firing.
-  double nextFireTime;
-  
-public:
-  TimerInfo(Timer *_timer, double _rate) 
-    : timer(_timer),
-      rate(_rate),
-      nextFireTime(util::getWallTime() + rate) {}
-  ~TimerInfo() { delete timer; }
-};
-
 void Executor::addTimer(Timer *timer, double rate) {
   timers.push_back(new TimerInfo(timer, rate));
 }