1

I am pretty new to programming and I want to know how to detect a memory leak? If you are going to recommend a utility, please try to find one that works on Mac OS X Lion.

P.S. I tried valgrind, it doesn't work on 10.7/Lion.

madtapper
  • 201
  • 2
  • 5
  • 11

3 Answers3

4

Valgrind is an excellent cross platform tool http://valgrind.org/

And best of all its Open Source

Adrian Cornish
  • 22,083
  • 11
  • 55
  • 77
2

I'd recommend Instruments (which comes with Xcode). I admit I've never used it for C, but works well with Objective-C.

ldav1s
  • 15,327
  • 2
  • 51
  • 55
  • Valgrind [has some issues](https://stackoverflow.com/questions/35964228/valgrind-and-pthreads-on-os-x-el-capitan-cant-make-a-smallest-working-exampl) with pthreads on a Mac running ~10.12. – datUser Jun 29 '18 at 13:40
1

valgrind - http://valgrind.org/ is pretty good

or mudflap - http://gcc.gnu.org/wiki/HomePage but i'm not sure if mudflap works on Mac OS though ,it works on most the linux platform, you could try =)

Jackyjjc
  • 542
  • 1
  • 3
  • 12