# Google perftools - [GitHub - Gperftools](https://github.com/gperftools/gperftools) ## What is Gperftools - Collecting information during execution, so you can understand software for debugging/tuning. - Supports C/C++ and all languages that can call C code. ## Different 1. CPU Profiler – performance of functions ```bash= gcc [...] -o myprogram -lprofiler CPUPROFILE=/tmp/profile ./myprogram ``` 2. TCMalloc – fast, thread aware malloc ```bash= gcc [...] -ltcmalloc ``` 3. Heap Leak Checker – memory leak detector ```bash= gcc [...] -o myprogram -ltcmalloc HEAPCHECK=normal ./myprogram ``` :::info 記憶體流失(**Memory leak**) - 由於疏忽或錯誤造成程式未能釋放已經不再使用的記憶體。 - 通常是應用程式分配某段記憶體後,由於設計錯誤,導致在釋放該段記憶體之前就失去了對該段記憶體的控制,從而造成了記憶體的浪費。 - 記憶體漏失只會在程式運行的時間內持續。 ::: 4. Heap Profiler – record program stack ```bash= gcc [...] -o myprogram -ltcmalloc HEAPPROFILE=/tmp/netheap ./myprogram ``` ## Reference ### Official - [GitHub - Gperftools](https://github.com/gperftools/gperftools) ### Article - [Tutorial: Introduction to Timing, GPerftools, Perf and PAPI](https://kth.instructure.com/courses/24933/pages/tutorial-introduction-to-timing-gperftools-perf-and-papi) - [Performance analysis using Gperftools and LTTng](https://hps.vi4io.org/_media/teaching/wintersemester_2011_2012/lul-1112-voecking-praesentation.pdf) - [Google Performance Tools安装以及使用](https://zhuanlan.zhihu.com/p/129380947)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up