Safe limit of memory usage today? - ios

I am developing a game for iOS. The memory I am using is around 80 MB according to the profile tool (no leaks). That just seems like a lot of memory to me. How much memory usage is safe, and are there any special programming issues associated with using a lot of memory?

It's all about what devices you plan to get you game. iPads are just fine with 100 MB of ram games, iPhone 3G's don't even have 100 mb. If you use a lot of memory you app will be forced to close, this could cause major problems if the user is on an old device.

Related

How to understand CPU and memory consumption in xcode debug

In Xcode 5, there's a new debug panel that shows the CPU and memory consumption in % and MB respectively. How do we make use of this? Is there a CPU % threshold I should try to stay below? I sometimes see my apps goes to 100% or over.. does that mean I am doing too much processing in my app and should try to optimize?
Any tips?
(PS. I'm developing on iOS)
A modern iPhone or iPad has 1024Mb memory.
But how much of that is available for apps is something that Apple has never divulged.
Just use as little memory as possible, and release non essential memory when the OS notifies your app about low memory.
Similarly, use as little CPU as possible, but more importantly, do not block the UI thread.
Use the profiler to find hot spots for CPU use and try to optimize those.

How much memory can I use when preloading textures?

I am trying to decide if I should preload all of my textures on a loading screen in my game, but I don’t know how much memory I can use for this. I looked around the web and I found where someone said that you can preload all of your textures as long as it is 80MB or under. If this is correct does that mean 80MB on all iOS devices (iPhone 3gs and up)?
Only the system knows
Ultimately, this question is all about memory. Apple doesn't care what you are doing with the memory, they just care how much you are using.
There is no 'hard set' limit on how much memory you can use on device X and up. The system (iOS) decides that.
If you are using too much, the system will send you a memory warning. If your memory usage grows, the system will begin to kill background tasks - like music, etc.
If you continue using too much, it will kill your app.
This differs between devices. For example, the 3GS has 256 MB of RAM, the 4 and above have 512 MB, and future devices may have more. Adjust accordingly.
So, test your app, watch for memory warnings, and optimize memory usage!

iOS and Cocos2d: received low memory warning with only 20 MB of allocation and no ther app running

I am getting low memory warnings even if my App is allocating only 20 MB of memory and there are apparently no leaks (See photo below). I am wondering whether this is due to some iOS version I am using (deployment target iOS 5.0 and running on an iPod touch 4th gen Version 5.0.1 (9A405)).
In the simulator this doesn't seem to appear.
Any suggestion?
EDIT: This is a similar question I found but not using Cocos2D. There is no answer to that quesiton to date.
From the screenshots its clear that the allocations spike noticably, I would say by a factor of 5 or more. That means for a short time your app is using 100+ MB of memory while most of the time it may only be using 20 MB.
Click on the time graph above one of the spikes to see what the memory usage at that point was, and which objects were using the most memory. Memory warnings can occur a bit later than the spikes so don't rely on their exact timing, but you can see that the alerts happened shortly after a memory usage spike.
Read this article to learn a few tricks to decrease memory usage spikes. Specifically loading the textures in the order from largest to smallest helps, as does using the .pvr.ccz image file format. Avoid using JPG images, they add a lot of memory overhead when loading (and because of that also load a lot slower than the other formats).

Difference between virtual memory consumption and real memory with Memory Monitor on iOS

I am stuck with an issue in my app. I have been testing up until now mostly on my iPad 3 with occasional checks on my iPad 1 to make sure all is well.
I am playing a UIImageView animation in my app and it keeps quitting with only a "Received memory warning" message before it quits.
I have been using the Object Allocations tool in instruments but according to that, my memory usage is way low. So after researching for a bit I came across this post by Mr. Larson: https://stackoverflow.com/a/5627221/329900
Now I am using the Memory Monitor tool instead. However, I don't understand why I am quitting. The 1st gen. iPad has 256MB of ram. Now I know I can't use all of that...some say you shouldn't use more than 100MB.
Is that real memory though, or virtual memory...or maybe some combination? My real memory is consistently between 20 - 25MB but the virtual is around 190 - 205MB when it crashes.
Here's a screenshot:
Anyone able to shed some light on this?
The WWDC (Session 242) video found by searching for iOS App Performance: Memory in the WWDC 2012 Session Videos page will give you a better understanding of the difference between VM and real memory.
But here is a quick overview:
A pointer Range = 2^32 = 4GB This is larger then the physical memory on any device(apple has shipped). This is done by taking all available space and dividing it up into 4kb chunks. Not all the memory your application can access is in physical memory at the same time. These 4kb chunks are call pages. Your allocations get split out of larger chunks of virtual memory. Then these virtual memory objects get mapped to physical memory.

Apple maps memory footprint

Did anyone had or have problems with the memory footprint (Live Bytes) when using the new Apple maps in an iPad application?
I tested my iPad app with Instruments and it seems the memory allocation jumps to over 70MB when displaying the map (and even 120MB when start zooming) -- while on iOS 5.1 (using Google Maps) the memory footprint is less than 4MB.
Or does anyone have a solution to this issue (reducing the memory footprint when using Apple maps)?
Thanks.
As I commented above, this became an issue required me to bang my head against a wall for some time. The straight answer is, yes this is an issue Apple accepts to be exists but they have some good excuses for that such as newer hardware devices should be able to handle this memory consumption without much pain. However, some people have already logged issues in their system, so there is nothing we can do until they fix it and release a patch.

Resources