使用UIWebView时内存泄漏在IOS4.0中加载请求 [英] Memory Leak while using UIWebView Load request in IOS4.0
问题描述
我有一个Web视图作为模态视图加载。使用以下代码加载网页后,我遇到内存泄漏。
[myView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: url]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:30]];
我的dealloc方法如下:
- (void)dealloc
{
myView.delegate = nil;
[myView release];
[url release];
[super dealloc]
}
仪器显示5块GeneralBlock 32泄漏,但没有可用的堆栈跟踪。 / p>
泄漏每次加载网页后都会发生,每次加载完全是5个块。如果我在页面完全加载之前关闭了modalview,则没有泄漏。如果我将缓存策略更改为NSURLRequestReturnCacheDataElseLoad,则只会在首次加载网页时发生此泄漏。
我已经尝试过以下链接中的方法,但它不工作对我来说。
任何帮助。
感谢。
我发现几个 UIWebView
相关漏洞在iOS 4.1之前(和报告一个详细),因为我使用HTML的大量在当前iOS应用程序的本地加载我正在开发。
从4.1开始,我没有看到任何漏洞。
如果你可以用4.1重新测试,泄漏已经消失了,那么我会忽略泄漏,继续前进。我已经有应用程序批准这些类型的泄漏,因为他们在苹果框架和在您的控制之外。
I have a Web View Which loaded as a modal view. I am having memory leaks after loading a webpage using the following code.
[myView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
timeoutInterval:30]];
My dealloc method is below:
- (void)dealloc
{
myView.delegate = nil;
[myView release];
[url release];
[super dealloc];
}
Instruments showing 5 blocks of GeneralBlock 32 leaks, but no stack trace available.
The leak Happens everytime after loading the web page and is exactly 5 blocks for each loading. if I dismiss the modalview before the page is fully loaded, there is no leak. If I change the cache policy to NSURLRequestReturnCacheDataElseLoad The leak happens only for the first time loading the webpage.
I already tried the methods in below link, but it doesn't work for me.
Any help is appreciated. Thanks.
I have found several UIWebView
-related leaks in iOS prior to 4.1 (and reported one in detail), as I use local loading of HTML heavily in the current iOS app I'm developing. They are all related to bugs with the WebKit implementation.
Since 4.1 I have not seen any of these leaks.
If you can re-test with 4.1, and the leaks are gone, then I would ignore the leaks and move on. I have had apps approved with these types of leaks, since they are in Apple frameworks and outside of your control.
这篇关于使用UIWebView时内存泄漏在IOS4.0中加载请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!