Skip to content

Commit 1e6a0b1

Browse files
committed
deps: backport 525b396195 from upstream V8
Original commit message: [cpu-profiler] Fix a leak caused by re-logging existing functions. Don't re-log all existing functions during StartProcessorIfNotStarted(). They will already be in the CodeMap attached to the ProfileGenerator and re-logging them causes leaks. See the linked bug for more details. Bug: v8:8253 Change-Id: Ibb1a1ab2431c588e8c3a3a9ff714767cdf61a88e Reviewed-on: https://chromium-review.googlesource.com/1256763 Commit-Queue: Peter Marshall <petermarshall@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#56336}
1 parent 2290c31 commit 1e6a0b1

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
# Reset this number to 0 on major V8 upgrades.
3535
# Increment by one for each non-official patch applied to deps/v8.
36-
'v8_embedder_string': '-node.37',
36+
'v8_embedder_string': '-node.38',
3737

3838
# Enable disassembler for `--print-code` v8 options
3939
'v8_enable_disassembler': 1,

deps/v8/src/profiler/cpu-profiler.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,11 @@ void CpuProfiler::StartProcessorIfNotStarted() {
368368
// Disable logging when using the new implementation.
369369
saved_is_logging_ = logger->is_logging_;
370370
logger->is_logging_ = false;
371+
372+
bool codemap_needs_initialization = false;
371373
if (!generator_) {
372374
generator_.reset(new ProfileGenerator(profiles_.get()));
375+
codemap_needs_initialization = true;
373376
CreateEntriesForRuntimeCallStats();
374377
}
375378
processor_.reset(new ProfilerEventsProcessor(isolate_, generator_.get(),
@@ -382,12 +385,14 @@ void CpuProfiler::StartProcessorIfNotStarted() {
382385
isolate_->set_is_profiling(true);
383386
// Enumerate stuff we already have in the heap.
384387
DCHECK(isolate_->heap()->HasBeenSetUp());
385-
if (!FLAG_prof_browser_mode) {
386-
logger->LogCodeObjects();
388+
if (codemap_needs_initialization) {
389+
if (!FLAG_prof_browser_mode) {
390+
logger->LogCodeObjects();
391+
}
392+
logger->LogCompiledFunctions();
393+
logger->LogAccessorCallbacks();
394+
LogBuiltins();
387395
}
388-
logger->LogCompiledFunctions();
389-
logger->LogAccessorCallbacks();
390-
LogBuiltins();
391396
// Enable stack sampling.
392397
processor_->AddCurrentStack(isolate_);
393398
processor_->StartSynchronously();

0 commit comments

Comments
 (0)