Pritesh Acharya
Pritesh Acharya

Reputation: 1626

Valgrind shows memory leak on empty program on Mac OSX 10.8

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

enter image description here

Upvotes: 7

Views: 2644

Answers (3)

user2683994
user2683994

Reputation: 29

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

Upvotes: 1

Hongli
Hongli

Reputation: 18924

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.

Upvotes: 6

PurpleAlien
PurpleAlien

Reputation: 896

Mac OSX 10.8 support in Valgrind is still limited. ImageLoaderMachO::doInitialization... should be in your suppression file.

Upvotes: 2

Related Questions