Skip to content

Commit a1aff28

Browse files
psmarshallrvagg
authored andcommittedFeb 28, 2019
deps: cherry-pick 525b396 from V8 upstream
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} Refs: v8/v8@525b396 PR-URL: #25041 Reviewed-By: Yang Guo <yangguo@chromium.org> Reviewed-By: Rod Vagg <rod@vagg.org>
1 parent 045868d commit a1aff28

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed
 

‎deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 6
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 414
14-
#define V8_PATCH_LEVEL 75
14+
#define V8_PATCH_LEVEL 76
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

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

+10-5
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,11 @@ void CpuProfiler::StartProcessorIfNotStarted() {
326326
// Disable logging when using the new implementation.
327327
saved_is_logging_ = logger->is_logging_;
328328
logger->is_logging_ = false;
329+
330+
bool codemap_needs_initialization = false;
329331
if (!generator_) {
330332
generator_.reset(new ProfileGenerator(profiles_.get()));
333+
codemap_needs_initialization = true;
331334
CreateEntriesForRuntimeCallStats();
332335
}
333336
processor_.reset(new ProfilerEventsProcessor(isolate_, generator_.get(),
@@ -341,12 +344,14 @@ void CpuProfiler::StartProcessorIfNotStarted() {
341344
isolate_->set_is_profiling(true);
342345
// Enumerate stuff we already have in the heap.
343346
DCHECK(isolate_->heap()->HasBeenSetUp());
344-
if (!FLAG_prof_browser_mode) {
345-
logger->LogCodeObjects();
347+
if (codemap_needs_initialization) {
348+
if (!FLAG_prof_browser_mode) {
349+
logger->LogCodeObjects();
350+
}
351+
logger->LogCompiledFunctions();
352+
logger->LogAccessorCallbacks();
353+
LogBuiltins();
346354
}
347-
logger->LogCompiledFunctions();
348-
logger->LogAccessorCallbacks();
349-
LogBuiltins();
350355
// Enable stack sampling.
351356
processor_->AddCurrentStack(isolate_);
352357
processor_->StartSynchronously();

0 commit comments

Comments
 (0)
Please sign in to comment.