Reputation: 7789
In iPod or iPad devices, when an application is running and the user presses the home button, the app goes into the background - but it still occupies some memory. What happens if a number of other apps take up more and more memory similarly? In my case, my app crashes with a memory warning - is there any solution or particular technique I should use?
In brief, actually i open one Cocos2D application after some time i will come in home screen icon and after that i open second cocoa2d application i got very less memory to drive this current app. I mean suppose if 1st app takes 80MB RAM and other application take (total device RAM memory - 80MB). can it possible ? id yes then why? How i tackle this problem becoz due to 1st application i will not able to drive 2nd application
Upvotes: 0
Views: 455
Reputation: 70673
If you want your app to run for a limited time in the background, and have set the appropriate background modes plist keys, your app must minimize it's memory footprint in order for the OS not to kill it. Release everything except the bare minimum resources required to run in the background, preferably to only a few MB of dirty memory. Since you can't display anything in the background, that means releasing all views, UI assets and images, etc. until your app becomes active again.
Upvotes: 0
Reputation: 53101
The first thing you should do is read the Apple documentation relating to App States and Responding to Low-Memory Warnings in iOS
Also see the Adopting Multitasking videos from WWDC 2010/11
Come back and ask if you have any more questions.
Upvotes: 2
Reputation: 5393
You should save your app status and data when your app before your app goes into the background.
Upvotes: 0
Reputation: 2227
you're right in that the more apps that are run the more memory is used, and if the OS decides it needs to free some memory it could kill your app. there's nothing you can do about this, apart from saving your application's state when the app enters the background (you really should do this anyway). never assume you'll stay resident in the background.
Upvotes: 2