[英]Valgrind shows memory leak on empty program on Mac OSX 10.8
Valgrind installed using brew. Valgrind使用brew安装。
#include <stdio.h>
#include <stdlib.h>
int main()
{
return 0;
}
gcc -g -o hello hello.c
valgrind --tool=memcheck --leak-check=yes ./hello
This is not a memory leak you need to worry about. 这不是您需要担心的内存泄漏。 ImageLoader is part of the OS X runtime and is responsible for loading binaries and dynamic libraries.
ImageLoader是OS X运行时的一部分,负责加载二进制文件和动态库。 It allocates some memory once, during initialization and forgets about it, but it's harmless because it's a small block of memory allocated only once.
它在初始化期间分配一些内存并忘记它,但它是无害的,因为它只是一小块内存分配一次。 And it does a bunch of things that Valgrind doesn't like but that aren't incorrect.
并且它做了许多Valgrind不喜欢的事情,但这并不是错误的。 You should add these to your suppression file .
您应该将这些添加到抑制文件中 。
Mac OSX 10.8 support in Valgrind is still limited. Valgrind的Mac OSX 10.8支持仍然有限。 ImageLoaderMachO::doInitialization... should be in your suppression file.
ImageLoaderMachO :: doInitialization ...应该在您的抑制文件中。
The other answer is correct, I just happened to have the same problem and had a little trouble creating the suppression file. 另一个答案是正确的,我碰巧遇到了同样的问题,并且在创建抑制文件时遇到了一些麻烦。 So, to help others, here is the minimal suppression file I generated for Mac OS X Mountain Lion: https://www.dropbox.com/s/2btyqnf8uesgsis/minimal.supp
所以,为了帮助其他人,这里是我为Mac OS X Mountain Lion生成的最小抑制文件: https : //www.dropbox.com/s/2btyqnf8uesgsis/minimal.supp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.