iphone 3gs memory warning calling query

520 views Asked by At

hi i just want to know this: When will iphone 3gs and iphone 4 send out memory warnings

i mean after how much memory our app uses does the both devices send warnings?

Thanks

2

There are 2 answers

7
MiKL On

It is not strictly defined but Apple suggests you don't use more than 24MB of graphical memory as overuse of graphical memory is typically why an application receives a low memory warning. The only good way to manage critical low memory situations on the iPhone is to implement the didReceiveLowMemoryWarning delegate methods and release as much memory as possible at that point. This means for instance:

  1. All non-visible images currently loaded in memory
  2. All view controllers and their subviews if not in use

This can of course be done safely provided your application is able to reload that information at a later stage. didReceiveLowMemoryWarning is however a last resort situation for your application.

To avoid getting to that point it is recommended to only load resources lazily i.e. when and only when you need them, and release them when they are no longer needed (for instance implementing viewDidUnload on all your controllers).

4
Ajay On

You don't know when it will fire. You don't know how much memory is being used by other apps running in the background, Safari keeping webpages, etc. Pandora might be streaming in the background and it might be using a significant amount of memory. Don't count on any single amount of memory. Load lazily, and release uneeded allocations in didRecieveMemoryWarning. If your app requires a lot of memory, some game developers tell their users to restart the device before playing to ensure the most memory for the app, and best performance.