额外分配valgrind

时间:2018-10-27 22:57:46

标签: c++ valgrind

这是我的valgrind输出

$ valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes new
==14028== Memcheck, a memory error detector
==14028== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==14028== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==14028== Command: new
==14028==
allocated
deleted
==14028==
==14028== HEAP SUMMARY:
==14028==     in use at exit: 72,704 bytes in 1 blocks
==14028==   total heap usage: 2 allocs, 1 frees, 72,754 bytes allocated
==14028==
==14028== 72,704 bytes in 1 blocks are still reachable in loss record 1 of 1
==14028==    at 0x4C29C23: malloc (vg_replace_malloc.c:299)
==14028==    by 0x4EBF18F: pool (eh_alloc.cc:117)
==14028==    by 0x4EBF18F: __static_initialization_and_destruction_0 (eh_alloc.cc:244)
==14028==    by 0x4EBF18F: _GLOBAL__sub_I_eh_alloc.cc (eh_alloc.cc:307)
==14028==    by 0x400FB02: _dl_init (in /usr/lib64/ld-2.17.so)
==14028==    by 0x4001069: ??? (in /usr/lib64/ld-2.17.so)
==14028==
==14028== LEAK SUMMARY:
==14028==    definitely lost: 0 bytes in 0 blocks
==14028==    indirectly lost: 0 bytes in 0 blocks
==14028==      possibly lost: 0 bytes in 0 blocks
==14028==    still reachable: 72,704 bytes in 1 blocks
==14028==         suppressed: 0 bytes in 0 blocks
==14028==
==14028== For counts of detected and suppressed errors, rerun with: -v
==14028== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

如您所见,多余的分配似乎来自我无法识别的某些来源,valgrind将其列为???。这只是幕后的一些怪异配置吗?我应该担心吗?

1 个答案:

答案 0 :(得分:1)

此分配/“仍可到达”的内存报告是正常的,并且已在valgrind bugzilla(和已修复)上报告:请参阅a.o。错误https://bugs.kde.org/show_bug.cgi?id=345307https://bugs.kde.org/show_bug.cgi?id=348978

您可能需要升级到更新的valgrind和/或更新的ld / glibc / ...才能解决所有问题。

同时,如果您还不能升级,则可以使用禁止文件。

使用valgrind选项--gen-suppressions = yes(或= all)运行valgrind +您的程序,以提供所需的抑制条目。