How much memory does iOS allow apps to use? - iphone

I am making an app that uses a lot of fairly big image files. I notice it crashes when they all get loaded on my iPhone 3G (128 mb ram), but not when I test it on a 3rd gen iPod (256 mb ram). So I assume there must be some percentage that is allowed for each app to use? My app has about 30 images at about 440k each loaded so 13.2mb. I didn't think that would be too much. They need to be swapped in and out pretty quickly, so releasing the ones not in use from memory doesn't seem like a good idea...
EDIT:
The app swaps images based on the way the phone is being tilted. It's 30 images from a 3D scene, so when you move it, it changes the perspective. It needs to be as smooth as possible.

The answer is: as much as you want, until the OS complains.
There is no such thing as an absolute memory limit, since it wholly depends on the phone's memory, how much the OS and its related services are taking up, and the time of the month (just kidding, but you get the idea).
You should be scaling down these large image files to fit into memory, or even more so, not loading them all at once considering the screen is so small and only so much can be viewed at any one particular time.

Related

iOS: Application in production. Which Size?

I am developping my first application on iOS. I am on this language since few days and I am going to share this application in Apple Store ASAP. But I have a big question around architecture.
Currently, I have with about 40 different type of Views, others components and a lot of PNG (30x30). I know that I can reduce considerably the number of Views through the development of a small framework but as it's my first learning-by-practice application, I wanted to move on quickly about all standards components and to start this development without architecture, reusables class or design pattern ... without think too hard.
To be short, I am wondering about the real size of applications in production and the performances. Have we got some constraints with:
Apple Store (upload apps)
Ram Capacity of iPhone during using
Download application from apple store for the user
etc...
Basicly, is it acceptable to have with about 40 screens for an iPhone Application?
Best regards.
There is a limit of 50 MB for over-the-air downloads.
Number of screens is probably not going to be a problem. The amount of executable code associated with each screen is probably not going to be significant. The bigger issue is how much PNG data you are going to have embedded in the app. A single 30x30 PNG isn't very big. 40 of them probably won't very big (depending on how well they compress). But if you have dozens of them per screen, or if you have a big hi-res background image for each screen, then the total amount of data could get big.
My advice would be to just start developing everything in the most straightforward way you can. Don't worry about sizes until you have some evidence that it may be a problem. And do a lot of testing on an actual device (don't rely on the Simulator) running whatever the oldest OS version is that you are willing to support.

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.

Aren't universal binaries a huge waste of memory on the device?

While working on an universal binary for iPhone / iPad, I've been asking my self often: Is this really so good? I believe the iPhone and iPod touch devices will simply download the whole package, including all the irrelevant iPad content. Since my app is graphics-heavy, the iPhone and iPod touch users would suffer from about 10 MB of irrelevant graphics. They're just trash and not used on their device. Same for iPad users, who will see something like 6 MB of garbage image data which is never used. Of course, along with all the non-used code for the device.
I wonder if this is really intelligent. If this is really the future: Downloading and installing a lot of trash and then worrying about buying an 8 GB, 16 GB, 32 GB or even 64 GB device just to be able to install more stuff. I already fear lots of the universal apps I have are just trashing my device full with unused files. It makes me feel stupid.
Any apps that aren't graphic heavy are worth making a universal binary for. eg: if you just have the standard cocoa UI elements and some data. Then all you do is set all the frames relative to the size of the frame.
If its effectively a seperate app (ie: you've got a ton of DIFFERENT picture files for the iPad version, then release it as such. Even if they are just higher-res pictures and such, it doesn't matter.)
You think that's silly? Try re-downloading an entire 80MB app (resources and all!) every time a small code change is made. :)
Given your figures of 8, 16, 32, 64 GB; I assume you're talking about storage capacity, rather than "memory" in the sense of RAM. If this is the case, you may consider compressing your resources and unzipping them to the app's sandbox for easy access on future boot-ups.
Alternatively, you could bundle only the iPhone / iPod resources with the app and download the iPad-specific resources separately. Users might not like the surprise bandwidth usage and it might not even get past Apple.
Finally, you could procedurally generate your resources and your users will love you for the saved space, if not battery life. Perhaps combine the best of both worlds and only generate the resources once?

What is the "normal" filesize for an app?

My app compiles to about 80mb. I was under the impression this was quite large. However it does have video content, high resolution images and we're charging ₤3.99 for it on the App store.
What would be "large" for an app? For instance, would you say 80mb was large? What would you say the limit is (realistically).
Thank you very much
Tom
I really don't think this can be answered objectively. You should do whatever you can to keep it as small as possible so you're not wasting storage space on the device. Just realize the app bundle's size isn't a reflection of the exectuable's size. If the executable is huge, that's a (memory) problem you should try to address. If most of it is resources, compress as well as you can without sacrificing too much (or any?) quality, and that's the best you can do.
In other words: there is no such thing as a "normal" size for an app.
Some of these high-resolution magazine apps are a few hundred megabytes (I know they're iPad, but the storage is the same size in each case). I think <100MB is not unreasonable.
That is pretty large. IMO anything over 20MB is large, seeing how it requires a WiFi connection to download. Since your well over that, I wouldn't worry about bringing it down.
Whenever possible, keep your app under 20MB. However, there are plenty of apps that are bigger than yours.

What's the limit for the size of iPhone apps?

I have an app which is quite huge. It has tons of images and sounds. In total it's 30 MB in size.
1) Is there an official limit for the app size?
2) Are there other "practical" limits I should consider?
Reading around, there are reports that the absolute maximum size for an application is 2GB (http://discussions.apple.com/thread.jspa?threadID=1605342).
Other than that, if your app is over 10MB, users will only be able to download it over a wifi connection, having the impact that users won't be able to download your application easily when they are out and about.
This might sound obvious, but there are two size limits to keep in mind here - neither are absolutely defined.
One is the limit for the application bundle. I don't know if there is a real limit (other than the device's flash storage limit), but this should rarely be an issue. Keep in mind the 10Mb threshold that the other Phil mentions though. There may be something in the 2GB limit too, I don't know.
The more important limit is on the size of the loaded binary image and it's runtime memory usage. The iPhone is obviously a constrained device in this area. The original iPhones and iPod touches had 128Mb of total RAM, with no paging. Current models have 256Mb, but it's a bit early to limit yourself to that subset of the installed base if you can help it.
Assuming 128Mb, of that a fair chunk is used by the system itself and its background tasks (and people want user background tasks too!?!).
In a conversation with an Apple Engineer he said that apps should be written to use no more than about 25-30Mb! Up to 60Mb may be available but cannot be counted on (but you could use this extra for caching stuff that you can purge as necessary).
1) I believe that you shouldn't ask for maximum size, as you have to aim for minimum possible size for your apps. As iPhone has limited memory (both storage & RAM), you should not create a huge app. (I doubt an app > 200MB can pass through Apple's app check.)
Yeah, Phil is right, when you app is over 10MB, it can only be downloaded via wifi or iTunes. Quite a lot users may want to download anywhere they like using 3G networks, so >10MB is not recommended.
Also, take care those users with iPhone 2G. If you produce a >10MB app, it takes them a day to download your app (if they are lucky enough to have no disconnection at the middle of download...)
2) practical limit ... K.I.S.S = Keep It Simple and Small.
That's it. Hope it helps.