What's the maximum memory footprint in MB for an typical iPhone app? - iphone

I know this is a subjective question. As far as I know, there are somewhat about 25 MB available for the app, but it depends on what else is going on. Currently playing music, a current phone call or what ever might drop that amount of memory down a lot. I don't know.
Just tell us what you think, or what you have experienced. My app currently consumes about 15 MB at a time, mostly lots of images loaded into views for animation. I have encountered no problems with this. But is there some "border" that can be drawn, to make a simple-to-follow rule like "do not consume more than x MB of memory at any given time", where x stands for the max amount?

This value highly varies per device and per user. For example, I restart my phone every few days, freeing up lost memory claimed by Apple and 3rd party leaks. My mother, has not restarted her phone ever on her own. EVER. She has tons of trouble with apps, gives me a call and I tell her to restart the phone to increase the ram. She does and the apps dont crash anymore.
Moral of the story is: Never plan on having available memory. You should always keep your memory down to the bare minimum you need at any given time.

You can use Instruments and launch some apps and find out for yourself.

Recently I found this awesome tool to find what is the maximum memory capacity of any iOS device.
We can also find at which memory level we received the Low Memory warning.
here is the link: https://github.com/Split82/iOSMemoryBudgetTest

Related

iPhone and iPad App Real and Virtual Memory usage

I've been trying to keep my iOS Apps memory footprint nice and low, however, I'm not really sure what a good threshold is for either real or virtual memory is iOS.
At the moment a very simple app is using 12MB real memory and 70MB virtual memory but this is going to increase as my app becomes more complex.
My question is, what are the real and virtual memory levels that I should try to keep below to avoid getting memory warnings?
I realise that this is not an exact science as there are other factors like the memory footprint of other apps on the system but a rough answer would be welcomed.
This is indeed not at all an exact science. In my experience it's at least as important to release enough memory immediately when receiving an OS request to do so as it is to keep memory low.
That being said, as long as I keep my apps under ~80 MB real memory on an iPad I typically don't get any warnings (for refernce, iPad 1 has 256MB). (keep in mind, this is the full memory used, including screen buffers etc. allocated by the OS for your app, not just what you allocated yourself)

available RAM iPhone app

how do i increase the available memory (more concrete: the part of the RAM) that can be used by my app?
i am not referring to the space available on the harddisk of an iphone, but to the RAM.
does anyone know if there's a way to use the whole free part of the RAM for my app only?
i have to clear this up a bit, sorry if it was too vague:
i had to think of the java heap size, which can be increased by adding a parameter to the startup command of the java programming.
as i don't know, but at the moment suppose on the iphone something similar happens (every app has just xxMB RAM for execution) this value might be adjustable, so that i can use the whole remaining RAM for my app.
which pretty much is what i need for this special app (non-app-store-publication; file-sizes between 50MB and several 100MB)
How do i increase the available memory?
Short answer: you don't.
Memory is managed by the kernel.
Your application process can't control this.
You can't explicitly control this - this is managed by iOS.
You can't do that. Try reducing your memory usage instead of looking for ways to remove well needed limits.
Store your data instead and read from it when needed.
I don't know for sure if you can configure RAM allocated for your app. I think that is taken care of by the iOS kernel
It's unlikely (read: not going to work) that you will be able to allocate anything more than a few Mb in your application at once.
Not planning on publishing your app to the App Store won't change this. Apple don't officially acknowledge the amount of memory in iOS devices. But its known that devices have between 128Mb and 512Mb of physical RAM.
With the kernel, essential applications (Phone app, etc), background processes, etc, you won't have anything like that available to your application. Careful analysis in instruments would suggest that you'll generally start getting memory warnings when you've allocated around 22Mb of RAM in your application.
A change made in iOS 5 makes the watchdog process much more aggressive with killing applications after you get a memory warning. If you get a memory warning on iOS5 you have to reduce your memory usage or you will get jettisoned by the OS.
If you want to proceed, you will have to figure out how to reduce the amount of memory your datasets require. Its unlikely that all of the 100Mb file needs to be in memory at once. iOS devices have "relatively" fast CPU's and storage, you'll have to architect your application to read and write to storage in chunks and work on smaller subsets of your data.
Some related Stackoverflow questions and links:
Monitor memory usage in an iphone app?
How much memory can an iPhone app use?
10 iPhone Memory Management Tips

What is the acceptable value for Live Bytes in Intsruments?

I was running my iphone app, optimizing to reduce memory footprint etc. I see that the live byte shows around 3.5 - 4 MB.
I was wondering what is an acceptable value. Put other way, what is the ceiling I should try to stay under.
Related thoughts, at what level do I get memory warnings, like level 1 level 2 memory warnings?
I am guessing this will have a direct correlation to my iphone device. Is there a matrix we can build depending on the device. I am using iphone 3G
thanks a ton
mb
if you stay under 20MB you should be fine, but as always the less you use the better ;-).
as far as I know the it isn't documented when the memory warnings are triggered, probably because that it is implementation detail and it can change at any moment.
Anyway you shouldn't focus too much on numbers (you don't know other memory consuming processes (safari caching pages, apps in the background using memory), just be a good ios-citizen, make sure you don't leak memory all over the place and your app will be working like a charm.

iPad/iPhone interesting memory observation

I have a quite a big iPad app and when I run the app in xcode debug mode, it shows about 50 MB in the Activity Monitor and memory grows slowly. (About 0.1 MB per 30 seconds approximately.) But when I run the app directly from the simulator(which is already installed in the simulator) , it shows about 10 MB in the activity monitor and memory is not growing.(its constant). I have checked the performance though the instruments and no leaks showing there.
Does anyone know for reason to showing different memory details for above 2 scenarios and which one is correct?
Also is there a way to programatically print the consumed memory by the app in the console?
Activity Monitor is a generally useless way to track memory growth. There are about a zillion different contributors to RPRVT, some of which are entirely non-intuitive. Activity Monitor can certainly be used to figure out "uh, oh, it is growing", but not much beyond that.
Use Instruments to track memory growth.
When you say "run in Debug mode", do you have anything configured like zombie tracking or allocation information tracking? That'll contribute to memory growth.
Beyond that, the Allocation Instrument will generally show you what is contributing to growth.
Also is there a way to programatically print the consumed memory by the app in the console?
An absolute number like this isn't very useful. That an app is growing is bad, but a raw number won't tell you why any more usefully than Activity Monitor.
Use Instruments. :)

iPhone: leaks from other Apps taking up RAM?

I'm reading some people stating that if another (3rd party) app on someone's iPhone has been leaking memory, that this may reduce the (mystery) amount of RAM your app would otherwise have available.
This confuses me -- does not all app memory get released when the app is closed by the user? And only one app is open at a time on iPhone?
Normally, any memory that your application allocates will be freed when it exits. However, many of Apple's applications continue running after they're "closed", so memory leaks in Mail, for instance, can affect available memory.
In addition, there are apps out there that claim to free up allocated memory. They really don't do anything other than force some dirty pages out of the buffer cache, but they appear to do something, so people believe they must be doing something useful.
On a jailbroken phone - yes, third party apps can be running at the same time as yours. Running out of memory is common with people who like to have many apps running at once hence the need for task managers, killing tasks etc.
On an unhacked phone - no. Yours is the only non-apple app that is running, no others can run at the same time.
So what can you do? All you can do is try to use the minimum memory possible which you're probably already doing. Realistically you can only test with a factory, unhacked phone, unless you are going to spend hours trying to please everyone. If you think you are maybe using too much you could identify the larger allocations using the instruments tools ("Run with performance tool >" from within Xcode) and then post that chunk of code here to get ideas of how to reduce it.
You should run Instruments and then add the instrument "Memory Monitor" to see the memory use of all of the other processes on your phone. (Add with Window -> Library , then drag the Memory Monitor instrument to the instrument panel.
What I'm still trying to determine is why is iOS releasing memory from MY app, and not all of the other memory pig apps that are not currently running.