We have an comprehensive iOS app with Hybrid mode - a UIWebView hold the major part of the web application in JS. It works fine on iOS6, but recently we found serious out of memory crash on all iOS7 device - iPad, iPhone 4/4S and iPhone 5/5C/5S. We did analysis of the memory consumption both on iOS6 and 7 in the iOS simulator. By doing same interaction in the app, the memory consumption of the WebView is always less than 200MB in iOS6, while it can exceed 800MB on iOS7!
We guess there is some serious memory management issue in the WebView on iOS7. But lack of the tool to profile the JS within the WebView, we cannot located the root cause.
Here we'd like to ask whether anyone has similar problems, and any tool / approach can help further look insight the UIWebView to dig to the exact problem. THx.

- 91
- 2
-
1This seems to be related to http://stackoverflow.com/questions/19150961/ios7-webkit-crashes-frequently-not-freeing-up-memory – Mark Nov 06 '13 at 08:57
2 Answers
I don't have enough reputation to upvote or comment. So I think an "answer" is the only way that I can contribute.
I agree with Ming Zhu's contribution. I found that if you have 5 digit keys (9999 < key <= 99999) the memory usage on iOS 7 explodes.
Below is the example code that I came to when trying to reproduce what was crashing my app.
tempobj = {};
for(var i=1; i<2000; i++){
var temp = {};
tempobj[i] = temp;
temp[98304] = "hello world";
}
I did also submit a bug to apple before finding this stackoverflow, but looks like that is a good thing anyways.

- 11,204
- 7
- 53
- 70

- 11
- 2
Both the UIWebView and the native safari browser with iOS7 seems to have a problem in memory management when handling json object. If you have a dictionary with a deep nested structure, and you happen to have one of the key to be a numeric string, and it is less than 99999, you might have received memory warnings frequently.
something like,
{"**98304**":
{"key":
{"2ndLevelKey":
{
"address":"10928 Homestead rd","city":"Cupertino","Zip":95014
}
}
}
}
The work around is simple, try to replace the key "98304" something like "ID98304". Hope you have tackled the problem already. :)

- 11,204
- 7
- 53
- 70

- 272
- 4
- 13
-
-
bug 15476175 was submitted to Apple on 14th Nov, no status update so far. – Ming Zhu Nov 26 '13 at 19:39