Unfortunately, Valgrind does not support OS X 10.8 yet. After some Googling, I came across some forum posts where people were able to get it to compile and "almost" link. Does anyone know of any good alternatives to Valgrind for memory leak detection?


Assuming you can be bothered, if you install MacPorts you will be able to install a functioning Valgrind (3.8.1 as for today) on your system. Unfortunately MacPorts will require you to install the whole XCode, not just the CL tools, so YMMV.

  • I came back to this question to post this information myself; I use MacPorts and realized that Valgrind now works. – void-pointer Jan 24 '13 at 12:39

While valgrind can be installed, the current state isn't very usable. In a simple program I got the following result;

==16016== HEAP SUMMARY:
==16016==     in use at exit: 63,264 bytes in 364 blocks
==16016==   total heap usage: 516 allocs, 152 frees, 67,154 bytes allocated
==16016== LEAK SUMMARY:
==16016==    definitely lost: 8,624 bytes in 14 blocks 
==16016==    indirectly lost: 1,168 bytes in 5 blocks
==16016==      possibly lost: 4,933 bytes in 68 blocks
==16016==    still reachable: 48,539 bytes in 277 blocks
==16016==         suppressed: 0 bytes in 0 blocks
==16016== Rerun with --leak-check=full to see details of leaked memory
==16016== For counts of detected and suppressed errors, rerun with: -v
==16016== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

The same code will be fine with using valgrind on a linux.(compiled on their respective systems)

  • You should provide way more details to get to any concusion. Using gcc on both? Or gcc/clang? Linking to what libraries/versions? Identical version and compile flags? – Narcolessico May 4 '17 at 6:54

The Instruments app (part of Xcode) is a very good way to look for leaks and run stress tests on the memory allocation of a running program.

  • Can you give some samples about how one could use Instruments to do the same thing as valgrind? – nohillside Nov 5 '12 at 17:56
  • See this thread for instance. Personnally, I still have issue on my new mac book pro retina which display unknown processor in the counter instrument yet it may work for you. – Sebastien Varrette Nov 14 '12 at 9:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .