Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C Valgrind和gtk链接_C_Memory Leaks_Gtk_Valgrind - Fatal编程技术网

C Valgrind和gtk链接

C Valgrind和gtk链接,c,memory-leaks,gtk,valgrind,C,Memory Leaks,Gtk,Valgrind,最近我和瓦尔格兰德之间发生了一些奇怪的事情。例如,如果我编写一个简单的test.c文件: #include <stdio.h> #include <stdlib.h> int main(){ printf("hello\n"); } 然而,如果我正常编译它,使用:gcc-g3-O0 test.c,然后使用:valgrind--leak check=full./a.out检查内存泄漏,我显然不会得到任何内存泄漏: ==7734== Memcheck, a memor

最近我和瓦尔格兰德之间发生了一些奇怪的事情。例如,如果我编写一个简单的
test.c
文件:

#include <stdio.h>
#include <stdlib.h>

int main(){
  printf("hello\n");
}
然而,如果我正常编译它,使用:
gcc-g3-O0 test.c
,然后使用:
valgrind--leak check=full./a.out
检查内存泄漏,我显然不会得到任何内存泄漏:

==7734== Memcheck, a memory error detector
==7734== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7734== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==7734== Command: ./a.out
==7734== 
hello
==7734== 
==7734== HEAP SUMMARY:
==7734==     in use at exit: 0 bytes in 0 blocks
==7734==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==7734== 
==7734== All heap blocks were freed -- no leaks are possible
==7734== 
==7734== For counts of detected and suppressed errors, rerun with: -v
==7734== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
所以我的问题是:为什么链接gtk会产生这么多内存泄漏


事先非常感谢

可能与非常感谢有关,但即使使用
valgrind./a--suppression=/path/to/gtk3.supp
,使用生成的
gtk3.supp
,我仍然会得到内存泄漏,尽管我必须承认它部分回答了我的问题。所以如果我理解的很好,我就无能为力了?
==7734== Memcheck, a memory error detector
==7734== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==7734== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==7734== Command: ./a.out
==7734== 
hello
==7734== 
==7734== HEAP SUMMARY:
==7734==     in use at exit: 0 bytes in 0 blocks
==7734==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==7734== 
==7734== All heap blocks were freed -- no leaks are possible
==7734== 
==7734== For counts of detected and suppressed errors, rerun with: -v
==7734== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)