开发者

Profiling C++ with Xcode

is it po开发者_如何学Cssible 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?


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


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.


Instruments is a great tool, as @pau.estalella says. Valgrind support for Mac OS X is now in the main Valgrind repository, courtesy of Greg Parker.


possible errors before running the program

Xcode 3.2 now comes with static analysis tool powered by Clang, which will detect logical errors such as unreleased memory at compile time.

It is just in Build > Build and Analyze menu.

Read Apple's documentation to get more detail.


This is a bit outside my current core competencies, but I've spotted a tool called Shark on my Mac which offers profiling and optimisation support. There are other Xcode tools too. But I've not yet used any of them for real. And I have no experience of valgrind on the Mac.

Not much of an answer, I know.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜