1 Star 0 Fork 25

吴超超/gperftools

forked from src-openEuler/gperftools 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Disable-large-allocation-report-by-default.patch 2.45 KB
一键复制 编辑 原始数据 按行查看 历史
吴旭 提交于 2020-01-10 20:19 . gperftools: delete useless patch
From fe87ffb7ea5a7c6ce4dea45222331716907ddbf4 Mon Sep 17 00:00:00 2001
From: Junhao Li <streaver91@gmail.com>
Date: Sun, 20 May 2018 13:45:32 -0400
Subject: [PATCH] Disable large allocation report by default
Fixes issue #360.
[alkondratenko@gmail.com: adjusted commit message a bit]
[alkondratenko@gmail.com: adjusted configure help message]
Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
---
configure.ac | 9 +++++++++
src/tcmalloc.cc | 4 ++++
2 files changed, 13 insertions(+)
diff --git a/configure.ac b/configure.ac
index 497103e..7b5e710 100644
--- a/configure.ac
+++ b/configure.ac
@@ -653,6 +653,15 @@ AC_COMPILE_IFELSE(
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])])
+# Disable large allocation report by default.
+AC_ARG_ENABLE([large-alloc-report],
+ [AS_HELP_STRING([--enable-large-alloc-report],
+ [report very large allocations to stderr])],
+ [enable_large_alloc_report="$enableval"],
+ [enable_large_alloc_report=no])
+AS_IF([test "x$enable_large_alloc_report" = xyes],
+ [AC_DEFINE([ENABLE_LARGE_ALLOC_REPORT], 1, [report large allocation])])
+
# Write generated configuration file
AC_CONFIG_FILES([Makefile
src/gperftools/tcmalloc.h src/windows/gperftools/tcmalloc.h])
diff --git a/src/tcmalloc.cc b/src/tcmalloc.cc
index 7b18ddb..48d4530 100644
--- a/src/tcmalloc.cc
+++ b/src/tcmalloc.cc
@@ -1272,9 +1272,11 @@ void* handle_oom(malloc_fn retry_fn,
// Copy of FLAGS_tcmalloc_large_alloc_report_threshold with
// automatic increases factored in.
+#ifdef ENABLE_LARGE_ALLOC_REPORT
static int64_t large_alloc_threshold =
(kPageSize > FLAGS_tcmalloc_large_alloc_report_threshold
? kPageSize : FLAGS_tcmalloc_large_alloc_report_threshold);
+#endif
static void ReportLargeAlloc(Length num_pages, void* result) {
StackTrace stack;
@@ -1295,6 +1297,7 @@ static void ReportLargeAlloc(Length num_pages, void* result) {
// Must be called with the page lock held.
inline bool should_report_large(Length num_pages) {
+#ifdef ENABLE_LARGE_ALLOC_REPORT
const int64 threshold = large_alloc_threshold;
if (threshold > 0 && num_pages >= (threshold >> kPageShift)) {
// Increase the threshold by 1/8 every time we generate a report.
@@ -1303,6 +1306,7 @@ inline bool should_report_large(Length num_pages) {
? threshold + threshold/8 : 8ll<<30);
return true;
}
+#endif
return false;
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wcc_140409/gperftools.git
git@gitee.com:wcc_140409/gperftools.git
wcc_140409
gperftools
gperftools
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385