Index: src/heap/memory-reducer.h |
diff --git a/src/heap/memory-reducer.h b/src/heap/memory-reducer.h |
index 4d15afa2e2dc5eee75680b820796da1b5a78c74c..0371f9d1b807062964a680a4da0177c133dd99e2 100644 |
--- a/src/heap/memory-reducer.h |
+++ b/src/heap/memory-reducer.h |
@@ -114,7 +114,7 @@ class MemoryReducer { |
// Posts a timer task that will call NotifyTimer after the given delay. |
void ScheduleTimer(double delay_ms); |
void TearDown(); |
- |
+ void ClearTask(v8::Task* task); |
static const int kLongDelayMs; |
static const int kShortDelayMs; |
static const int kMaxNumberOfGCs; |
@@ -126,7 +126,11 @@ class MemoryReducer { |
public: |
explicit TimerTask(MemoryReducer* memory_reducer) |
: memory_reducer_(memory_reducer), heap_is_torn_down_(false) {} |
- virtual ~TimerTask() {} |
+ virtual ~TimerTask() { |
+ if (!heap_is_torn_down_) { |
+ memory_reducer_->ClearTask(this); |
+ } |
+ } |
void NotifyHeapTearDown() { heap_is_torn_down_ = true; } |
private: |