代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gperftools 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 893bff51bcf220b724a812d340d878b5fb8ce911 Mon Sep 17 00:00:00 2001
From: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Date: Sun, 26 Aug 2018 11:35:44 -0700
Subject: [PATCH 23/39] Avoid static initialization of pprof path for
symbolization.
This is one of the things that chrome's fork fixes, but with c++11 we
can do it even nicer. Proposed fix is to use c++11 local static
variable to ensure that pprof path is initialized once on as-needed
basis.
---
src/symbolize.cc | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/symbolize.cc b/src/symbolize.cc
index 88609ff..4c71010 100755
--- a/src/symbolize.cc
+++ b/src/symbolize.cc
@@ -67,15 +67,17 @@
using std::string;
using tcmalloc::DumpProcSelfMaps; // from sysinfo.h
-
-DEFINE_string(symbolize_pprof,
- EnvToString("PPROF_PATH", "pprof"),
- "Path to pprof to call for reporting function names.");
-
-// heap_profile_table_pprof may be referenced after destructors are
+// pprof may be used after destructors are
// called (since that's when leak-checking is done), so we make
// a more-permanent copy that won't ever get destroyed.
-static string* g_pprof_path = new string(FLAGS_symbolize_pprof);
+static char* get_pprof_path() {
+ static char* result = ([] () {
+ string pprof_string = EnvToString("PPROF_PATH", "pprof");
+ return strdup(pprof_string.c_str());
+ })();
+
+ return result;
+}
// Returns NULL if we're on an OS where we can't get the invocation name.
// Using a static var is ok because we're not called from a thread.
@@ -144,7 +146,7 @@ int SymbolTable::Symbolize() {
PrintError("Cannot figure out the name of this executable (argv0)");
return 0;
}
- if (access(g_pprof_path->c_str(), R_OK) != 0) {
+ if (access(get_pprof_path(), R_OK) != 0) {
PrintError("Cannot find 'pprof' (is PPROF_PATH set correctly?)");
return 0;
}
@@ -206,7 +208,7 @@ int SymbolTable::Symbolize() {
unsetenv("HEAPPROFILE");
unsetenv("HEAPCHECK");
unsetenv("PERFTOOLS_VERBOSE");
- execlp(g_pprof_path->c_str(), g_pprof_path->c_str(),
+ execlp(get_pprof_path(), get_pprof_path(),
"--symbols", argv0, NULL);
_exit(3); // if execvp fails, it's bad news for us
}
--
1.8.3.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。