Index: src/cpu-profiler.cc |
diff --git a/src/cpu-profiler.cc b/src/cpu-profiler.cc |
index b1af621cccc1a3425e87534faafa8b14cea77c7f..ef39341ef0c789570eb9b8f05c896ce91e6f226e 100644 |
--- a/src/cpu-profiler.cc |
+++ b/src/cpu-profiler.cc |
@@ -176,6 +176,10 @@ void CpuProfiler::DeleteAllProfiles() { |
void CpuProfiler::DeleteProfile(CpuProfile* profile) { |
profiles_->RemoveProfile(profile); |
delete profile; |
+ if (profiles_->profiles()->is_empty() && !is_profiling_) { |
+ // If this was the last profile, clean up all accessory data as well. |
+ ResetProfiles(); |
+ } |
} |