|
发表于 2022-1-19 15:39:20
浏览:4407
|
回复:0
打印
只看该作者
[复制链接]
楼主
如下,t是我编写的一个存在内存泄露的小程序,用valgrind成功检测到了,但是没有显示行号,在3399的ubuntu系统和buildroot系统下均是如此:
- root@firefly:~# valgrind --leak-check=full ./t
- ==2693== Memcheck, a memory error detector
- ==2693== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
- ==2693== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
- ==2693== Command: ./t
- ==2693==
- hi
- ==2693==
- ==2693== HEAP SUMMARY:
- ==2693== in use at exit: 1 bytes in 1 blocks
- ==2693== total heap usage: 2 allocs, 1 frees, 1,025 bytes allocated
- ==2693==
- ==2693== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1
- ==2693== at 0x4845BFC: malloc (in /usr/lib/valgrind/vgpreload_memcheck-arm64-linux.so)
- ==2693==
- ==2693== LEAK SUMMARY:
- ==2693== definitely lost: 1 bytes in 1 blocks
- ==2693== indirectly lost: 0 bytes in 0 blocks
- ==2693== possibly lost: 0 bytes in 0 blocks
- ==2693== still reachable: 0 bytes in 0 blocks
- ==2693== suppressed: 0 bytes in 0 blocks
- ==2693==
- ==2693== For counts of detected and suppressed errors, rerun with: -v
- ==2693== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
- root@firefly:~#
复制代码
而检测相同的程序t,在x86下就会显示行号,如下:
- ==17689== Memcheck, a memory error detector
- ==17689== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
- ==17689== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
- ==17689== Command: ./t
- ==17689==
- hi
- ==17689==
- ==17689== HEAP SUMMARY:
- ==17689== in use at exit: 1 bytes in 1 blocks
- ==17689== total heap usage: 2 allocs, 1 frees, 1,025 bytes allocated
- ==17689==
- ==17689== 1 bytes in 1 blocks are definitely lost in loss record 1 of 1
- ==17689== at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
- ==17689== [color=Red]by 0x10869B: main (t.c:6)[/color]
- ==17689==
- ==17689== LEAK SUMMARY:
- ==17689== definitely lost: 1 bytes in 1 blocks
- ==17689== indirectly lost: 0 bytes in 0 blocks
- ==17689== possibly lost: 0 bytes in 0 blocks
- ==17689== still reachable: 0 bytes in 0 blocks
- ==17689== suppressed: 0 bytes in 0 blocks
- ==17689==
- ==17689== For counts of detected and suppressed errors, rerun with: -v
- ==17689== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
复制代码
|
|