我正在研究一个C应用程序中的内存泄漏问题,该应用程序运行在带有ARM CPU的嵌入式Linux系统(Yocto 1.5)上。
Valgrind 3.8.1安装在目标上。
C程序是用gcc 4.8编译的,带有-g和-Og,没有被剥离。
我已经用下面的命令启动了valgrind:
$ valgrind --tool=memcheck --leak-check=full /tmp/e3event-daemon -c /etc/e3event-daemon/config.json
字符串
valgrind的输出:
==7035== Memcheck, a memory error detector
==7035== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==7035== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==7035== Command: /tmp/e3event-daemon -c /etc/e3event-daemon/config.json
==7035==
==7035==
==7035== HEAP SUMMARY:
==7035== in use at exit: 4 bytes in 1 blocks
==7035== total heap usage: 421 allocs, 420 frees, 148,246 bytes allocated
==7035==
==7035== 4 bytes in 1 blocks are definitely lost in loss record 1 of 1
==7035== at 0x4834558: operator new(unsigned int) (in /usr/lib/valgrind/vgpreload_memcheck-arm-linux.so)
==7035==
==7035== LEAK SUMMARY:
==7035== definitely lost: 4 bytes in 1 blocks
==7035== indirectly lost: 0 bytes in 0 blocks
==7035== possibly lost: 0 bytes in 0 blocks
==7035== still reachable: 0 bytes in 0 blocks
==7035== suppressed: 0 bytes in 0 blocks
==7035==
==7035== For counts of detected and suppressed errors, rerun with: -v
==7035== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
型
报告了一个内存泄漏,但是缺少一个 *by 0x 8048691:main(in. * 行。如果我在我的Ubuntu Linux机器(valgrind 3.10.1)上运行相同的程序,我会得到这一行,它指示问题所在。
我应该怎么做才能让这个 *by 0x 8048691:main(in. * 打印出来?
1条答案
按热度按时间ttisahbt1#
检查您的vgpreload_memcheck-arm-linux.so是否从其调试信息中剥离。