Tag Archives: iOS memory

iPad – How much memory can I use?

iPad

iPad

The iPad is shipped with 256mb of RAM, so we thought that programming for the iPad would allow more memory consumption than the iPhone 3G which had a paltry 32mb.

Our application was a graphics intense magazine, which used the full 130ppi screen resolution with high resolution images formatted in a gallery.

Each image was 2mb compressed, which exploded to 6mb uncompressed. Using a lazy load approach, which loads an image plus an one either side recruits 18mb of memory, just to hold the images. We thought this was well within the iPad’s boundaries of memory consumption, but were quickly proved wrong!

With the extra payload of just 2 views in memory we were frequently getting memory warnings and random crashes.

A whole month was spent optimising code and ensuring no memory leaks were the root cause. In a final act of desperation, we reduced the image quality down to 72ppi and instantly our app crashes stopped!

Running the instrument Leaks told us the story. As soon as our application went over 24mb of total memory usage, we encountered random crashes.

We went back to the drawing board and recoded our app to keep us within the memory bounds of 20mb total, and were happy with the final result, however, it raises the question as to why there are no official Apple docs on this. A Google search won’t net you any answers to this question either of ‘How much memory can my app use’.

Clearly the iPad has a lot of overhead with shared graphics memory, and system buffers, but to allow only 10% of memory for developers is a bit of a worry, especially with iOS 4.2 just around the corner, how usable will fast switching be? How many background tasks will actually be able to be executed before the system dumps the whole app from memory?

Or was 3.2 a inefficient pig and 4.2 will actually free up more memory for developers?

I guess time will tell soon enough!