Testing the memory limits of Safari on Ipod Touch

In order to find out the memory usage limit in safari on my Ipod Touch I wrote some javascript to grab chunks of data 500Kb at a time from a web service and waited to see how long it took to crash. The Touch ran smoothly right up to recieving 24Mb of data in memory (via javascript). At which point it promply crashed/stopped playing music and then shut down/crashed safari.

 This probably means that you should limit your pages to use around 4-5Mb of data maximum (in case the user has multiple pages open that are memory heavy). In reality I think you could get away with 10-15Mb as I doubt that any user will really open up more than 2-3 pages as this feature on the touch/iphone doesnt work that well.

 I also recorded the time it took to load 500Kb. For me this took around 23 seconds. In an ajax world this means you would not want to load more than 100Kb at a time as users would have to wait more than 5 seconds (5sec is a rule of thumb for max page load time). One second wait time would be better so a better target chunk size might be 20Kb depending on your connection speed of course.


The Verdict:

Use up to 15Mb of memory in your Iphone / Ipod Touch Safari Web Application.

Make web service calls of up to 100Kb. Aiming for a chunk size of 20Kb (or less for slow links).