Must follow:
- For every alloc, retain, copy you should have a release as soon as you are going to leave it
- Avoid using autoreleased objects, You can use autorelease objects but keep in mind that they will not be released until their pool is released
- Always respond to memory warnings and take them seriously
- Stick to Lazy Loading, means defer initialization of an object until the point at which it is necessity.
- Don't release the objects that we don't own.
- Reuse your objects instead of declaring new ones, in possible scenarios.
- If you are not using same resource repeatedly then avoid methods like [UIImage imageNamed:@""] because these method will increase cache size, a better alternate is [UIImage imageWithContentsOfFile:@""]
- Build custom UITableCell, UICollectionViewCell etc; and reuse them properly
- Override setters properly
- Use initWithCapacity when size is known to you
- Use delegates carefully, remember to set delegate properties to nil before releasing its owner; otherwise, the object might think that its delegate is still there, and will send a message to an invalid pointer.
- Use LLVM/Clang Static Analyser tool. It will catch errors regarding the Objective-C naming conventions and hidden memory leaks when using foundation frameworks
- Enable Guard Malloc
- Enable NSAutoreleaseFreedObjectCheckEnabled
- Enable NSZombieEnabled
- Enable NSDebugEnabled