Getting memory warning is a serious issue, which cannot be neglect by any developer developing mobile application. You should always free up the variables that take most of the memory in didReceiveMemoryWarning method of your class.
There is no use of showing alert to user that this app is consuming a lot of memory because its none of their business and what can they do. Instead you should focus on how to reduce memory consumption without user Interaction .Following are the ways to reduce memory consumption in your App
- Allocate UI Elements when they are visible . Don’t hide them , instead remove them from superView and allocate them again when in use.
- Empty all cache when Low memory pressure occurs.
- Limit the scope of your Variable when ever possible . All @property of type (Strong , retain , copy) will be remain active until your Controller deallocated.
- Find places of potential leak using static Analyzer.
- Find and remove leaks using Leak tools in Instrument available . See Finding Leaks in your App in the Instruments User Guide.
- Use the Allocation instrument to check which part of your application consuming a lot of memory.
- If you are using Core Foundation classes ? Make sure you are releasing every allocation manually using CFRelease.
- Make sure you are not creating too many autorelease objects in one go . If you are creating then reduce the scope by creating your own AutoreleasePool
by using @autoreleasepool declarative