Steven Barnes
Steven Barnes

Reputation: 23

Fixing iPhone memory leaks, getting started

I am an experienced C/C++ programmer, and familiar with memory management issues. I've also shipped a couple small iPhone apps in the past. I am attempting to check my latest app for memory leaks, and I can't make any headway, because there are so many of them. Just starting the app and viewing the first screen shows over 12,000 leaks.

I know I've probably overlooked various things, but I was reasonably cautious in writing the code. I made attempts to release everything I alloc'ed in my dealloc method. It is like my app delegate never gets released, because I can see a couple things that are only alloc'ed once, in the app delegate's init method. They are never modified, and are released in the dealloc method.

This app is built around a tab controller, with around 15 views mainly set up using Interface Builder.

Any help would be appreciated.

Upvotes: 2

Views: 190

Answers (1)

Antwan van Houdt
Antwan van Houdt

Reputation: 6991

Instruments of apple is pretty advanced.. it can show you the exact method that originally created the memory leak, I suggest taking a look at those methods and carefully reading your code ,there usually is this line of code in there and you thought OMG how could I be that stupid.

If that doesn't help, try to "Analyze" with xcode, its pretty good at finding errors and leaks in your code and saved my * a couple of times.

Upvotes: 5

Related Questions