Appropriate Link saying Memory limits of App in iOS - iphone

I am developing an Application for iPad & it consumes 5.5 MB at max on RAM of the iPad. I have ensured all this stuff using Instruments number of times. As soon as App uses little bit more memory, It throws memory warnings & app start behaving abnormally.
I have implemented the lines of code for freeing the memory in did-receive memory warning.
I also have ensured that NO LEAKS in the entire app.
I came to know that App needs at-least 6 mb memory.
Here is the general flow of the app.
log in -> 1st-list View -> 2nd-list view -> 3rd-list view -> 4th-Map & listview -> 5.Map&List
brief of each screen.
log-in - simple screen with username-pswd, making a web-service call & authenticating user
based on result of authentication, it will fetch few more data & list it on 1st-list View screen.
based on selection from 1st-list, app will load list on 2nd-list view
based on selection from 2nd-list, app will load list on 3rd-list view
based on selection from 3rd-list, app will load list & map will have pins relatively.
based on annotation from Map, app will navigate to another maps & different pins.
Here, app receives memory warnings on 6th screen. I have ensured all coding standards & all importance of all objects.
In Above case, All screens are very necessary, I am using Navigation Controller & just pushing view-controllers one by one. no duplications - ensured twice.
Now, the point is, App is being tested on iPad-1 with iOS 4.1 & all apps are forcefully closed before starting the testing of the app.
THOUGH, app receives warnings # just 5.5 mb usage.
I tried to convince my project managers that, this amount of memory usage is high & they are asking me - there should some option to set MEMORY. How this kind of High Graphics games & apps are running smoothly ?
I can't find appropriate document from Apple saying LIMIT. I have no answer to them.
If setting Memory limit is not possible, I am requesting you to provide Appropriate PROOF link, so that I can show it to my Project Manager.
If that kind of settings is possible, I am highly eager to know how to make that.

I doubt you will find any positive statement about memory limits for an app under iOS coming from Apple docs.
But if you google "ios app available memory" you will find a lot of information; e.g., this S.O. thread.
In my experience, my apps can sustain a "peak" memory usage of about 20MB (depending on the device state), but then memory use must quickly go well below the 10MB threshold for the app not to be killed (I would say that 6-8MB is more precise figure). Sometimes an app can be killed just because a peak cannot be "undone" fast enough.
One piece of information that might be useful for your managers is the output from the "Memory Monitor" tool in Instruments, specifically the "free physical memory". If you use it, you will invariably see that your app will be killed when the "free physical memory" goes below a given limit (as per Instruments output), approaching zero left memory.
Now, whether that limit is reached because you allocated some memory (which is reported by the Allocations or Leaks tools) or because of other factors (a framework loaded into memory? something in the iOS kernel or that is not tracked by Instruments?) you cannot know. But for sure you can follow how the free physical memory in the device varies over time with the use of your app.
Hope this helps.

The first generation iPad has a total of 256 MB of memory. Of course some of that will be used by the operating system itself.
It's very conservative to assume that at least 64 MB would be available for your application. So 6 MB sounds pretty minimal to me. There must be something your application is doing that causes more memory to be allocated.
There definitely isn't some "I'm a game let me use more memory option". All applications are allowed to use as much memory as they can (though it's always a good practice to minimize memory usage). If memory runs low, the application is notified, and if memory is exhausted, the foreground application is terminated.
If your application is terminated, examine the crash log to see how much memory it was using. My guess is that you'll find you are using more than you think.

Related

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

iphone 3gs memory warning calling query

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
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.
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:
All non-visible images currently loaded in memory
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).

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.

How do I see how much memory my iPhone app is using?

How much real memory should my iphone app be using? What's going too high?
Keeping an eye on -(void)applicationDidReceiveMemoryWarning:(UIApplication *)application is definitely important, but if this is game, chances are the assets (notably textures presently on screen) can't simply be deallocated when that warning is received.
If you're a bit on the high side (20 MB +) I would recommend doing a bit of testing. Using Instruments and the Object Allocation tool (Run > Run with Performance Tool > Object Allocations) you can monitor how large your memory footprint gets. Then, try running Safari and fill the pages, then a few games and whatever else you can to get the memory higher, and see how your app performs.
In my testing for a recent release, 24 MB seemed to be pretty safe, and is a number I've heard elsewhere. Once you get above 30 or so MB, chances are your users will start having rare crashes (which happens to be the case for us, verified by crash reports). The higher you go, the more crashes users will see. There's no specific limit though, for the sake of testing I've pushed my app on an iPhone 3G up to 70 MB before, it just isn't likely to work for most, nor for long.
Requesting on the iTunes page that users restart their devices can help, though there's no guarantees it'll be effective.
Also, this is all assuming devices prior to the 3GS / 3rd Gen iPod Touch. If the app merely runs on an older device, it should have no problem on the newer ones (which have twice as much ram, 256 MB).
I think available memory may depend on several factors such as device model, how long it has not been rebooted etc.
You should not rely on some fixed values but instead try to use as little memory as possible and implement -(void)applicationDidReceiveMemoryWarning:(UIApplication *)application in your application delegate and/or -didReceiveMemoryWarning in your view controllers to handle low memory warnings there and free unused memory.