NSTimer
If you create an NSTimer object on a view controller, be sure that invalidate is called on it when dismissing the view controller, otherwise it will retain self.Observers/NSNotificationCenter
If you add an observer to NSNotificationCenter, make sure you remove all observers when dismissing the view controller, otherwise they will retain self.Blocks
You should not call [self doSomething] from inside a block, this can easily lead to the block capturing a reference to self. Instead, make a weak reference to self:Delegates
if you use
someObj.delegate = self;
inside the view controller, check the delegate property on someObj is weak.
@property (nonatomic, weak) id delegate;
BAD:
dispatch_async(queue, ^{
[self doSomething];
});
GOOD:
__weak MyViewController *safeSelf = self;
dispatch_async(queue, ^{
[safeSelf doSomething];
});
Once you’ve made your fixes, check that dealloc is getting hit and the allocations no longer increase endlessly