查找内存泄漏及重定向~~~~

valgrind是一个不错的工具,可以
#yum install valgrind
#valgrind --tool=memcheck --leak-check=full  --show-reachable=yes ./xxxx &>123.txt
#valgrind --tool=memcheck --leak-check=yes ./xxxx &>123.txt
==6478== 3,868 (28 direct, 3,840 indirect) bytes in 1 blocks are definitely lost in loss record 77 of 77
==6478== at 0x4006011: calloc (vg_replace_malloc.c:593)
==6478== by 0x804C83B: parsecmd (parsecmd.c:206)
==6478== by 0x804BD1E: main (main.c:337)
==6478==
==6478== LEAK SUMMARY:
==6478== definitely lost: 57 bytes in 4 blocks
==6478== indirectly lost: 3,840 bytes in 5 blocks
==6478== possibly lost: 24,001 bytes in 1,233 blocks
==6478== still reachable: 2,222 bytes in 6 blocks
==6478== suppressed: 0 bytes in 0 blocks
==6478== Reachable blocks (those to which a pointer was found) are not shown.
==6478== To see them, rerun with: --leak-check=full --show-reachable=yes
==6478==
==6478== For counts of detected and suppressed errors, rerun with: -v
==6478== Use --track-origins=yes to see where uninitialised values come from
==6478== ERROR SUMMARY: 791 errors from 80 contexts (suppressed: 18 from 8)

很强大~~~

1. &>file n>&m 均是一个独立的重定向符号,不要分开来理解。
2. 明确文件和文件描述符号的区别。
3. &>file 表示重定向标准输出和错误文件。
引用:http://www.360doc.com/content/13/0523/16/7044580_287544243.shtml
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值