Memory leak detection tools

Viewed 80337

Does Apple's Xcode development environment provide any tools for memory leak detection?

I am especially interested in tools that apply to the iPhone SDK. Currently my favourite platform for hobby programming projects

Documentations/tutorials for said tools would be very helpful.

11 Answers

There is one specifically called Leaks and like a previous poster said, the easiest way to run it is straight from Xcode:

run -> Start with Performance Tool -> Leaks

It seems very good at detecting memory leaks, and was easy for a Non-C Head like me to figure out.

Select Profile from the Product menu in Xcode 6 to launch Apple's Instruments tool. (The application is located inside the Xcode application's package contents: /Applications/Xcode.app/Contents/Applications/)

A commercial alternative is OmniObjectMeter. (Discontinued by The Omni Group)

You can run the tools within Xcode over menu -> run -> start with performance tool -> ...

ObjectAlloc and MallocDebug should both be of help to you. If you installed the entire SDK, they will be found in Developer->Applications->Performance Tools.

Their names give you a pretty good clue as to their functions, OA, tracks the objects create and MA is a general memory leak tool.

I haven't tried them with iPhone development yet, but I have to believe that they would work there as well.

Assuming you have registered for ADC iPhone developer site, here the link to follow:Instruments User Guide

When using rustyshelf's solution make sure you test on the iPhone and not on the simulator. Memory usage is dramatically different.

Related