views:

160

answers:

2

I'm pretty new to iPhone Development and running into troubles with memory management.

I built a Multiview Application with this structure:

Main Menu - Preferences - Subview with UIPicker Item.

The navigation is done with a Navigation Controller (Push/Pop view to/from stack).

Everything works fine. But if I'm switching about 20 times from Preferences to Subview with UIPicker, the program crashes.

Sometimes I get a message like this:

objc[5817]: FREED(id): message release sent to freed object=0x3d53390

Problem is, that I don't know where the problem is.

Is there any kind of possibility to get some extended information to see which object did the crash?

A: 

In my case, I retain an object at initialization and release when I don't need it anymore.

IF you need more detail, professional solution, take a look at Memory Management Programming Guide for Cocoa

mxg
+1  A: 

You might want to post some code to see if anyone can catch where your error is, but to answer your question:

You can enable Zombies

What you do is enable zombies in your application, and this makes it so when an object is deallocated, instead of freeing the memory, it gets stored away with the type of object it used to be. The app then crashes when this memory is touched again, telling you where it first was touched when it shouldn't have been, and what type of object it was.

Be sure when you're done to disable zombies, since it uses up so much memory.

bobDevil