Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling C++ with Xcode

is it possible to profile C++ apps with Xcode so one gets;

  • memory leaks like with valgrind
  • possible errors before running the program

Thanks, I am very new to mac and xcode

Where can one find a good tutorial for this?

like image 887
asdf Avatar asked Dec 31 '09 10:12

asdf


2 Answers

You have a tool called Instruments, a free Apple tool included in XCode, that catches most of those errors.

like image 80
pau.estalella Avatar answered Sep 30 '22 18:09

pau.estalella


Regarding memory leaks, run XCode and then launch Start with Performance Tool -> Leaks

Alternatively and necessarily for old pre-Panther users of XCode, it is possible to debug with guard malloc, detailed explanation in the Mac development docs, but here is a quick walk-through.

like image 25
mloskot Avatar answered Sep 30 '22 17:09

mloskot