4

Please suggest the best way of solving memory leaks on the iphone. What is the best use of release, autorelease, retain and which cases do each apply?

Brad Larson
  • 169,393
  • 45
  • 393
  • 567
Hiren Gujarati
  • 1,009
  • 12
  • 32

4 Answers4

6

You can track memory leaks with Instruments: see this tutorial.

If you're familiar with Valgrind, you use it on x86 binaries built against the iPhone Simulator SDK: see how Landon Fuller does it.

EDIT: Another Stackoverflow answer suggests the Clang analyser: static analysis of the code may detect memory allocation errors as well. I never used this tool myself but it's good to know it's possible.

Community
  • 1
  • 1
Gregory Pakosz
  • 67,118
  • 19
  • 136
  • 163
1

There's Apple's Instruments.app in your /Developer/Applications folder, which is intended to test appplications for leaks and other errors.

I believe you will find a good tutorial.

Jacek
  • 1,874
  • 5
  • 21
  • 33
0

Also see Apple's Introduction to Instruments User Guide.

jww
  • 90,984
  • 81
  • 374
  • 818