7

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

anishsane
  • 20,270
  • 5
  • 40
  • 73
Pritesh Acharya
  • 1,596
  • 5
  • 15
  • 36
  • What is `ImageLoaderMach0`? – Alex Apr 25 '13 at 08:56
  • I'm not sure. I got a big pile of error message above that. – Pritesh Acharya Apr 25 '13 at 08:59
  • 1
    @Alex Mach is the name of the underlying kernel on that OS. Mach-O is the name of the executable format (http://en.wikipedia.org/wiki/Mach-O ). “ImageLoader” I will leave to your interpretation. Note that “ImageLoaderMach0” is not part of the OP's inputs and that, essentially, the OP asked this question because he does not fully know what that piece of code does (give or take). – Pascal Cuoq Apr 25 '13 at 09:00
  • Probably, you will have to suppress this memory-leaks, as they are a third-party in your code or not maintained by you. It is strange, though. (http://wiki.wxwidgets.org/Valgrind_Suppression_File_Howto) – boaz_shuster Apr 25 '13 at 09:35
  • 1
    Mac OSX 10.8 support in Valgrind is still limited. ImageLoaderMachO::doInitialization... should be in your suppression file. – PurpleAlien May 04 '13 at 01:30
  • @PurpleAlien, you should submit your comment as the answer. – Cargo23 May 06 '13 at 15:49

3 Answers3

6

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.

Hongli
  • 18,682
  • 15
  • 79
  • 107
2

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

PurpleAlien
  • 886
  • 6
  • 7
1

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