抑制文件过于普遍?
我是valgrind的新手,首先要注意的是,OS X El Capitan上的标准C-Library似乎泄漏了内存(可能丢失了)。 在多读一点之后,情况并非如此,可以使用抑制文件从valgrind泄漏摘要中排除system-lib。
我生成了一个这样的压缩文件(通过运行一个简单的程序)并将这些错误添加到压缩文件中。 它看起来像这样:
osx_el_capitan_c_lib.supp
{
<osx_el_capitan_c_lib>
Memcheck:Leak
match-leak-kinds: possible
fun:malloc_zone_malloc
fun:_objc_copyClassNamesForImage
fun:_ZL9protocolsv
fun:_Z9readClassP10objc_classbb
fun:gc_init
fun:_ZL33objc_initializeClassPair_internalP10objc_classPKcS0_S0_
fun:layout_string_create
fun:_ZL12realizeClassP10objc_class
fun:_ZL22copySwiftV1MangledNamePKcb
fun:_ZL22copySwiftV1MangledNamePKcb
fun:_ZL22copySwiftV1MangledNamePKcb
fun:_ZL22copySwiftV1MangledNamePKcb
}
现在我有几个问题:
==37004== Memcheck, a memory error detector ==37004== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==37004== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==37004== Command: ./val.o ==37004== ==37004== ==37004== HEAP SUMMARY: ==37004== in use at exit: 22,100 bytes in 187 blocks ==37004== total heap usage: 271 allocs, 84 frees, 28,340 bytes allocated ==37004== ==37004== LEAK SUMMARY: ==37004== definitely lost: 0 bytes in 0 blocks ==37004== indirectly lost: 0 bytes in 0 blocks ==37004== possibly lost: 0 bytes in 0 blocks ==37004== still reachable: 0 bytes in 0 blocks ==37004== suppressed: 22,100 bytes in 187 blocks ==37004== ==37004== For counts of detected and suppressed errors, rerun with: -v ==37004== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 18 from 18)正如你所看到的,压缩文件现在非常有效(没有字节显示为丢失等)。 但堆概要不会受到压缩文件的影响(
allocs
/ mallocs
显示 - 它们发生在我的代码之外),并且泄漏摘要显示为压缩,因为它是自己的字段。 有没有一种方法可以禁用此字段(标志或某物),并在堆摘要中抑制(我的代码之外的allocs
/ mallocs
)?
链接地址: http://www.djcxy.com/p/64949.html