我正在调查在具有 ARM CPU 的嵌入式 Linux 系统 (Yocto 1.5) 上运行的 C++ 应用程序中的内存泄漏问题。
Valgrind 3.8.1 已安装在目标上。
C++ 程序是使用带有 -g 和 -Og 的 gcc 4.8 编译的,并且没有被剥离。
我使用以下命令启动了 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 0x8048691: main (in ... 行丢失。如果我在我的 Ubuntu Linux 机器 (valgrind 3.10.1) 上运行相同的程序,我会得到这一行,表明问题出在哪里.
我应该怎么做才能得到这个by 0x8048691: main (in ... 打印出来?