views:

70

answers:

4

I've just kind of been 'winging' it with long tests (for hours) with no crashes, and eyeballing my code for quite a while and made sure that everything looks pretty kosher as far as memory leaks. But should I be using instruments... is it mandatory to do this before uploading to app store?

A: 

No.

But at least run "Build & Analyze" in the XCode. It tells you what it can find about the memory leaks, just by analyzing the source code statically. It's basically eye-balling the code by the machine. It's infinitely better than doing that yourself. If there're any warnings issued, fix all of them. It's rare for the static analyzer to give false positives.

Also, running your app with Instruments is helpful to see how it really allocates memories. Sometimes it's fun, too.

Yuji
So I take it you DON'T use instruments before uploading your apps? Not that I'm judging you, I'm just curious;)
Shnitzel
I'll always have a bug when developing, so I run Instruments anyways. I just answered your question whether it's mandatory or not.
Yuji
yes you did, i was just wondering. thanks
Shnitzel
+2  A: 

I think that using Instruments is not only good practice, it's strongly recommended by the iOS development community as a whole. Even if your app seems to run fine, you still may have leaks in other use cases. Test your app thoroughly with Instruments before pushing to the App Store or you may be in for a lot of users on older generation devices complaining that the app crashes.

Some of the most crucial tools:

Leaks

Allocations

Time Profiler

Another suggestion alongside using Instruments is to compile with the -pedantic flag.

Jacob Relkin
A: 

I would never publish an app without running Instrument's leak tool.
I often miss a release somewhere. And even if I read the code 200 times I would not find it without Instruments.

fluchtpunkt
+1  A: 

In addition to what Yuji said, turn on as many warnings as you can in the build settings, by default these are off.

Anders K.
Indeed. And: treat warnings as errors.
Yuji