configure: WARNING: No frame pointers and no libunwind. Using experimental backtrace capturing via libgcc. Expect crashy cpu profiler.
这是因为没有安装 libunwind。这里直接使用 yum 的方式安装:
1
yum install libunwind-devel
再次执行 ./configure,命令执行成功。
编译并安装
执行如下两个命令,进行编译并安装:
1 2
make sudo make install
最后执行 ldconfig 更新动态库文件
确认安装成功
执行如下命令,确认 gperftools 安装成功
1 2 3 4 5 6 7 8 9
[root@36eab106d3bf gperftools-2.9.1]# pprof --version pprof (part of gperftools 2.0)
Copyright 1998-2007 Google Inc.
This is BSD licensed software; see the source for copying conditions and license information. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
HeapLeakChecker heap_checker("test_foo"); { code that exercises some foo functionality; this code should not leak memory; } if (!heap_checker.NoLeaks()) assert(NULL == "heap memory leak");
If you are still puzzled about why the leaks are there, try rerunning this program with HEAP_CHECK_TEST_POINTER_ALIGNMENT=1and/or with HEAP_CHECK_MAX_POINTER_OFFSET=-1 If the leak report occurs in a small fraction of runs, try running with TCMALLOC_MAX_FREE_QUEUE_SIZE of few hundred MB or with TCMALLOC_RECLAIM_MEMORY=false, it might help find leaks m Exiting with error code (instead of crashing) because of whole-program memory leaks
[root@36eab106d3bf gperftools-test]# env HEAPCHECK=normal ./memory_leak WARNING: Perftools heap leak checker is active -- Performance may suffer memory leak test Have memory regions w/o callers: might report false leaks Leak check _main_ detected leaks of 4 bytes in 1 objects The 1 largest leaks: Using local file ./memory_leak. Leak of 4 bytes in 1 objects allocated from: @ 4008ff func @ 400935 main @ 7f39d94db555 __libc_start_main @ 400829 _start
If the preceding stack traces are not enough to find the leaks, try running THIS shell command:
If you are still puzzled about why the leaks are there, try rerunning this program with HEAP_CHECK_TEST_POINTER_ALIGNMENT=1and/or with HEAP_CHECK_MAX_POINTER_OFFSET=-1 If the leak report occurs in a small fraction of runs, try running with TCMALLOC_MAX_FREE_QUEUE_SIZE of few hundred MB or with TCMALLOC_RECLAIM_MEMORY=false, it might help find leaks m Exiting with error code (instead of crashing) because of whole-program memory leaks