I have a tab bar app with 4 tabs and nothing spectacular in the code.
All simulator testing is fine, there are no crashes with the app, everything works great, there are no warnings or errors shown up in Xcode (I am using Xcode 4.2 and the app uses storyboarding).
When running ‘analyse’, there are no leaks, errors or potential leaks in the code.
When running ‘leaks’, no leaks are listed, and I can load, reload, swap between tabs, etc, and all is fine.
When I run this on an iPhone, though, lots of leaks show up!
Some of them seem to be in code that is all released and looks fine, and all validates fine within Xcode.
Why is this different running on the phone from the simulator, and how can I find and debug leaks that dont show up when running leaks on the simulator?
First, by limiting the inspection range (with the left and right range buttons) to the area where leaks occur, you can inspect a smaller area. Then, by selecting some useful checks from the Call Tree on the left hand side, like Show Obj-C only, Hide Missing Symbols, etc.. then you’ll get a lot more useful info from the Instruments. After that, click on one of the lines related to the leak, open Extended view and start examining your call stack. Also, as far as I could remember, double clicking on a leak line can take you to the source code where the leaked object is allocated. Be careful here, because it does not show where the leak happens, it shows where the leaked object is allocated. So, you should follow what happens to these objects, then.
And about the difference between simulator and the device, you can check this SO question.
Hope these help!