Instruments Leaks - Not showing my source code

Andrew Garrison picture Andrew Garrison · Apr 8, 2009 · Viewed 7.4k times · Source

I am attempting to analyze an iPhone application using the Leaks application and everything appears to be working fine, except for when I try to view detailed information about a particular memory leak. Leaks does not appear to be loading my source code. Looking at the stack view on the right, I can see calls that reference iPhone frameworks, but anything that is referencing source code that I've written is empty. The screenshot below illustrates my point. The blocks that are light blue should be referencing my source code. Has anyone ever had this problem? Is Leaks just not finding my source code/symbols correctly? Thanks!

EDIT: I am compiling the app using the 'Device - iPhone OS 2.2' with the Debug configuration. I launch Leaks by selecting Run->Start With Performance Tool->Leaks from within Xcode. How would one go about 'making the symbol files available' for Leaks?

alt text
(source: andrewgarrison.com)

Answer

AWrightIV picture AWrightIV · Nov 29, 2010

For iOS 4.0 and higher, the way to fix symbols and turn those useless memory addresses into beautiful file names, function names and line numbers is as follows:

  1. In Xcode, go to Run -> Run with Performance Tool and choose your instrument
  2. After Instruments loads, hit the Stop button to stop recording. Go to File -> Re-Symbolicate Document.
  3. In the new window, click Path and click the plus (+) button to add a new path. Navigate to the folder containing your project file and click Open. Click Symbolicate.
  4. Profit!

I was looking for this for a good month before I finally came upon the solution. I hope this helps some of you!