Cyven's Braindump

Valgrind

  • belong: TODO

干什么的?

官方的说法

Valgrind is a GPL’d system for debugging and profiling Linux programs. With Valgrind’s tool suite you can automatically detect many memory management and threading bugs, avoiding hours of frustrating bug-hunting, making your programs more stable. You can also perform detailed profiling to help speed up your programs.

简单来说,它侧重于检查内存泄露以及性能分析

原理

Valgrind构建了一个虚拟的CPU,当用Valgrind运行程序的时候,它会监控程序对内存做的每一个动作(分配,读取,写入,释放)

因为程序运行再虚拟CPU上,会非常慢