R – Could someone explain the colors and meaning of strack trace in Apple’s Instruments tool

instrumentsmemory-leaks

I'm trying to be a good programmer and fix the leaks in my iPhone app…
I can't understand though what the Stack Trace in Leaks is trying to tell me.
There are multi coloured stack calls and I guess each color means something, but what?

Also .. in the screenshot below all calls in the stack trace are not from any of my classes, does that mean the leak is caused by code in iPhone SDK or some message returned me retained object which I was supposed to release ? Maybe all the colours can hint me on that issue?

Instruments Stack Trace Screenshot

alt text http://blog.underplot.com/files/leaks.png

Thanks

Best Answer

The colors (colours) are the types of libraries your code is employing (which often means stuff you do not call explicitly--Instruments call them the 'responsible libraries.'). If you turn the 'color by library' option off in the settings menu at the top of the Stack Trace cell, it'll revert to white/light blue cells so as to not distract you.

Among the colors I've seen:

  • Pink = Core Foundation
  • Brown = WebCore
  • Cyan = A.Dylib
  • Light green = B.Dylib
  • Purple = Foundation
  • Khaki = AppKit

You normally read the stack from bottom up (or invert that order in the settings, and you can turn on frame numbers and file icons for each of the items to help you keep it straight.)

Related Topic