2

Need some advise here. Can you recommend some tools or methods to detect memory leaks and more importantly check for 'EXC_BAD_ACCES' errors.

Is NSZombie recommended? I tried to use that was not able to run the malloc history.

Any advise is greatly appreciated!

Zhen Hoe

Zhen
  • 12,361
  • 38
  • 122
  • 199
  • Before using MallocStackLogging really try NSZombieEnabled, Analyze, and Instruments. It's easier. And yes, NSZombieEnabled helps a lot since most EXC_BAD_ACCESS come from over released pointers. – Jano May 22 '11 at 22:30
  • @Jano, thanks. I was having a little issue with the NSZomnbie... http://stackoverflow.com/questions/6066699/objective-c-where-to-find-process-id-in-gdb. I could not seem to be able to run the malloc history command in gdb, any advise on that? – Zhen May 23 '11 at 02:15

2 Answers2

1

For memory leaks, you can use Instruments, comes with the Developer tools. Also, you can use “Analyze” to get XCode to show you any possible leaks (Cmd-Shift-B).

margusholland
  • 3,306
  • 1
  • 23
  • 30
  • Hi, thanks! Do you mind sharing with me more details on how to use instruments? Do I need to enable any settings? – Zhen May 23 '11 at 02:16
  • I’m quite new to iOS development, so I don’t know that much about any specific settings etc. I just run with the defaults. – margusholland May 23 '11 at 05:56
  • @Zhen: @margusholland: Here is the good tutorial to use leak tool(for both of you ..:)..) http://mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/ – rptwsthi May 28 '11 at 09:45
  • This one too is good [How to debug](http://www.raywenderlich.com/2696/how-to-debug-memory-leaks-with-xcode-and-instruments-tutorial) – rptwsthi May 28 '11 at 09:57
0

you can use "NSZombieEnabled" to track your EXC_BAD_ACCESS problem(it'll give you some details of badly accessed objects), how to use it?, and also refer this link(very consitently) Break on EXC_BAD_ACCESS in XCode?

Community
  • 1
  • 1
rptwsthi
  • 10,094
  • 10
  • 68
  • 109