调整gperftools中Heap Profiler输出字符串缓冲区大小到1<<22,并升级gperftools.

* heap profiler工具中定义的Heap文件输出缓冲区过小(1<<20),当使用内存较多时无法正确输出Heap文件。通过Patch的方式调整。
  * 升级gperftools到最新稳定版本2.8。
This commit is contained in:
Qiuwen Lu
2020-10-15 15:51:45 +08:00
parent 90ac86a10c
commit 24f79a5a20
4 changed files with 17 additions and 3 deletions

View File

@@ -101,7 +101,7 @@ ExternalProject_Add(ratelimiter PREFIX ratelimiter
CONFIGURE_COMMAND ""
BUILD_COMMAND make
BUILD_IN_SOURCE 1)
ExternalProject_Get_Property(ratelimiter INSTALL_DIR)
file(MAKE_DIRECTORY ${INSTALL_DIR}/include)
@@ -334,8 +334,9 @@ target_link_libraries(brotlienc-static INTERFACE brotlicommon-static)
### gperftools
ExternalProject_Add(gperftools
PREFIX gperftools
URL ${CMAKE_CURRENT_SOURCE_DIR}/gperftools-2.7.tar.gz
URL_MD5 c6a852a817e9160c79bdb2d3101b4601
URL ${CMAKE_CURRENT_SOURCE_DIR}/gperftools-2.8.tar.gz
URL_MD5 ea61ad1e886f53e4069873ce52cae7df
PATCH_COMMAND patch -p1 < ${CMAKE_CURRENT_LIST_DIR}/patch/gperftools-fix_too_small_heap_profile_buffer_size.patch
CONFIGURE_COMMAND ./configure --prefix=<INSTALL_DIR> --disable-shared
BUILD_IN_SOURCE 1)

Binary file not shown.

BIN
vendor/gperftools-2.8.tar.gz vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,13 @@
diff --git a/src/heap-profiler.cc b/src/heap-profiler.cc
index 33a25ac..4d750bb 100644
--- a/src/heap-profiler.cc
+++ b/src/heap-profiler.cc
@@ -151,7 +151,7 @@ static void ProfilerFree(void* p) {
}
// We use buffers of this size in DoGetHeapProfile.
-static const int kProfileBufferSize = 1 << 20;
+static const int kProfileBufferSize = 1 << 22;
// This is a last-ditch buffer we use in DumpProfileLocked in case we
// can't allocate more memory from ProfilerMalloc. We expect this