3

I am running valgrind on the macos x 10.8. Valgrind says on startup

"==11312== WARNING: Support on MacOS 10.8 is experimental and mostly broken.
==11312== WARNING: Expect incorrect results, assertions and crashes.
==11312== WARNING: In particular, Memcheck on 32-bit programs will fail to
==11312== WARNING: detect any errors associated with heap-allocated data."

Valgrind is giving this leak summary:

"LEAK SUMMARY:
==11312==    definitely lost: 0 bytes in 0 blocks
==11312==    indirectly lost: 48 bytes in 2 blocks
==11312==      possibly lost: 0 bytes in 0 blocks
==11312==    still reachable: 45,857 bytes in 270 blocks
==11312==         suppressed: 16,805 bytes in 87 blocks"

According to valgrinds faq, http://valgrind.org/docs/manual/faq.html#faq.deflost, "indirectly lost" means your program is leaking memory in a pointer-based structure. (E.g. if the root node of a binary tree is "definitely lost", all the children will be "indirectly lost".) If you fix the "definitely lost" leaks, the "indirectly lost" leaks should go away.

I dont have any definitely lost leaks or even possibly lost leaks to fix. What am I supposed to fix? Could this report be a bug due to the experimental nature of valgrind in 10.8?

I believe i am compiling this as a 64 bit program since the compiler is a 64 bit compiler.

Zachary Kraus
  • 1,051
  • 10
  • 21
  • I don't know how this works, but: Could it be something referenced from those suppressed leaks? – Dark Falcon Mar 26 '14 at 18:39
  • I am not sure its possible. I dont know enough about valgrind and how it works in Mac. I am trying to test the software on linux right now to test the comment from presius but the software behavior is completely different on linux than in macos x. Apparently I have to rebug the program. The good news is according to valgrind on linux there are no leaks just 8 errors. – Zachary Kraus Mar 26 '14 at 19:39
  • The errors show the code compiled on linux is skipping over functions so if the code should be f1->f2->f3. f2 is being skipped entirely. I got to love debugging. – Zachary Kraus Mar 26 '14 at 19:50

2 Answers2

1

I feel weird answering my own question.

Yes the report by valgrind on mac is incorrect. According to valgrind on linux all heap blocks were freed so no leaks are possible.

I really hope valgrind fixes the issues with mac since I mainly am developing on mac now.

Zachary Kraus
  • 1,051
  • 10
  • 21
0

Valgrind has been updated. Use (if you use homebrew):

brew unlink valgrind
brew install valgrind

And, lo and behold:

==23998== LEAK SUMMARY:
==23998==    definitely lost: 0 bytes in 0 blocks
==23998==    indirectly lost: 0 bytes in 0 blocks
==23998==      possibly lost: 0 bytes in 0 blocks
==23998==    still reachable: 76,800 bytes in 2 blocks
==23998==         suppressed: 58,420 bytes in 359 blocks
Bart Louwers
  • 873
  • 9
  • 28