Valgrind的显示在Mac OSX 10.8的空的程序内存泄漏 [英] Valgrind shows memory leak on empty program on Mac OSX 10.8

查看:151
本文介绍了Valgrind的显示在Mac OSX 10.8的空的程序内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用BREW安装Valgrind的。

Valgrind installed using brew.

#include <stdio.h>
#include <stdlib.h>
int main()
{
    return 0;
}

gcc -g -o hello hello.c

valgrind --tool=memcheck --leak-check=yes ./hello

推荐答案

这是不是你需要担心内存泄漏。 ImageLoader的是OS X运行时的一部分,负责装载的二进制文件和动态库。它分配了一些内存一次,初始化期间和忘掉它,但它是无害的,因为它是只分配一次较小的内存块。它做了一堆东西,Valgrind的不喜欢但并非不正确。您应该这些添加到您的SUP pression文件

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. 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. You should add these to your suppression file.

这篇关于Valgrind的显示在Mac OSX 10.8的空的程序内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆