0

I recently inherited an iPhone app. The original developer did not understand memory management and well the app works in simlulator but not in on old iPhone (lots of crashses). Do you have any thoughts on the process by which I can save the app?

Can I utilize or create any unittest to find memory leaks and make the process 'scientific'?

Thanks

2 Answers 2

5

Yes! Use Clang! Here is a good tutorial showing the benefits: http://iphonedevelopment.blogspot.com/2009/02/clang-static-analyzer.html

However, it should be installed if you have a newer SDK.

3
  • On the same topic, there's also: oiledmachine.com/posts/2009/01/06/…
    – RyanWilcox
    Commented Mar 5, 2010 at 21:49
  • Yes, the link I posted is actually quite old. If you're using a newer SDK, you shouldn't need to download, just select llvm as your compiler, and make sure you run the analyzer.
    – pkananen
    Commented Mar 5, 2010 at 21:57
  • You don't need to select Clang LLVM as the compiler. The analyzer works fine regardless of which compiler you're using. Commented Mar 6, 2010 at 0:35
2

Since the Clang Static Analyzer is now built-in to Xcode on Snow Leopard, it's trivial to use it. Select Build -> Build & Analyze to see any memory problems Clang detects (hint: it will find pretty much all of them).

3
  • Better yet, turn on the “Run Static Analyzer” build setting. Then Xcode will run the analyzer on every build. Commented Mar 6, 2010 at 0:36
  • @Peter Hosey: The only problem with that is as of Xcode 3.2.1, having this setting enabled can cause problems with codesense :(
    – jbrennan
    Commented Mar 6, 2010 at 6:43
  • jbrennan: Huh? That makes no sense. Could you be more specific, or link to something that is? Commented Mar 6, 2010 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.