
本文共 2206 字,大约阅读时间需要 7 分钟。
Valgrind���������������������������������������������������������������������������������������������������������������������������������������������������������������������������
������Valgrind������������������������Debian������������������������������������������
apt-get install valgrind
���������������������������������������������������������������
valgrind --version
���������Valgrind���������������������������������������Memcheck���������������������Valgrind���������������Memcheck������������������������������
valgrind --tool=memcheck --leak-check=full ./test
������������������������������������������������������������������������������������������������C������������������������������������������
#include#include void test() { char* p = (char*)malloc(1024);}int main() { test(); return 0;}
������������������
gcc main.c -o test
������Valgrind����������������������������������������� Coset ������������
valgrind --leak-check=full ./test > valgrind.log
������������������������������������������������������������������������������������
������������HEAP SUMMARY���
- ���������������������������1024������������������������ -�������������������������������������������������
���������������������LEAK SUMMARY���
- Definitely lost���������������������1024���������������������������������������������������������������������������������������������������
- Indirectly lost���������������������������������������
- Possibly lost���������������������������������������
- Still reachable���������������������������������������
- Suppressed������������������������������������
###_collections������ ������������������������������1KB������������������Malloc������������������������������������������������������������������������������������free()���������������������������������������
������������������������������������������������������������������������������������������Valgrind���������������������������������������������������������
������������������������������������������������������������������������������������������Valgrind���������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
