summaryrefslogtreecommitdiff
path: root/deps/v8/src/profiler/heap-profiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/profiler/heap-profiler.cc')
-rw-r--r--deps/v8/src/profiler/heap-profiler.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/deps/v8/src/profiler/heap-profiler.cc b/deps/v8/src/profiler/heap-profiler.cc
index 71e297c4bf..3a1df29bd4 100644
--- a/deps/v8/src/profiler/heap-profiler.cc
+++ b/deps/v8/src/profiler/heap-profiler.cc
@@ -23,9 +23,14 @@ HeapProfiler::~HeapProfiler() = default;
void HeapProfiler::DeleteAllSnapshots() {
snapshots_.clear();
- names_.reset(new StringsStorage());
+ MaybeClearStringsStorage();
}
+void HeapProfiler::MaybeClearStringsStorage() {
+ if (snapshots_.empty() && !sampling_heap_profiler_ && !allocation_tracker_) {
+ names_.reset(new StringsStorage());
+ }
+}
void HeapProfiler::RemoveSnapshot(HeapSnapshot* snapshot) {
snapshots_.erase(
@@ -126,6 +131,7 @@ bool HeapProfiler::StartSamplingHeapProfiler(
void HeapProfiler::StopSamplingHeapProfiler() {
sampling_heap_profiler_.reset();
+ MaybeClearStringsStorage();
}
@@ -159,6 +165,7 @@ void HeapProfiler::StopHeapObjectsTracking() {
ids_->StopHeapObjectsTracking();
if (allocation_tracker_) {
allocation_tracker_.reset();
+ MaybeClearStringsStorage();
heap()->RemoveHeapObjectAllocationTracker(this);
}
}