iOS7 UIWebView内存泄漏 [英] iOS7 UIWebView Memory leak

查看:138
本文介绍了iOS7 UIWebView内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个全面的iOS应用程序,混合模式 - 一个UIWebView在JS中保存Web应用程序的主要部分。它在iOS6上运行良好,但最近我们在所有iOS7设备上发现了严重的内存崩溃 - iPad,iPhone 4 / 4S和iPhone 5 / 5C / 5S。我们在iOS模拟器中对iOS6和7上的内存消耗进行了分析。通过在应用程序中进行相同的交互,iOS6中WebView的内存消耗总是小于200MB,而iOS7上的内存消耗可能超过 800MB


我们猜测iOS7上的WebView存在严重的内存管理问题。但是缺乏在WebView中分析JS的工具,我们找不到根本原因。
在这里,我们想问一下是否有人有类似的问题,任何工具/方法都可以帮助进一步了解UIWebView以深入了解确切的问题。谢谢。

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.

推荐答案

我没有足够的声誉进行upvote或评论。所以我认为答案是我能做出贡献的唯一方式。

I don't have enough reputation to upvote or comment. So I think an "answer" is the only way that I can contribute.

我同意明朱的贡献。我发现如果你有5个数字键(9999< key< = 99999),iOS 7上的内存使用量会爆炸。

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";
}

在找到此stackoverflow之前我还向苹果提交了一个错误,但看起来像无论如何,这是一件好事。

I did also submit a bug to apple before finding this stackoverflow, but looks like that is a good thing anyways.

这篇关于iOS7 UIWebView内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆