Right so I get this one a lot, especially when I’m coding late at night and tired…which is most of the time. So, my main culprits are objects that I haven’t released in my dealloc method.

Especially look for anything that you created with ALLOC INIT, for example an array

[[NSMutableArray alloc] init]

You must, must, must release it.

Second most common is not removing the class from observing a Notification. So if you have something like

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(classMethod:) name:@"notificationName" object:nil];

Then again in your dealloc method, you must put this

[[NSNotificationCenter defaultCenter] removeObserver:self];

I’m sure there are more things, and I’ll add notes as I discover them.

Leave a Reply