uiwebview and huge memory loss

喜夏-厌秋 提交于 2019-11-30 09:12:39
Naveen Shan

Just check the following 1. Is u make the webview as property remove it 2. And put the following code in didFinishLaunchingWithOptions in Appdelegate

    NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
    [NSURLCache setSharedURLCache:sharedCache];
    [sharedCache release];

I think then ur problem is solved

VdesmedT

I guess that since you set webview=nil, you lose any chance to release it.

I know this thread is a bit old but just for an idea and to add few more relevant bits i would like to add these tips so the future visitors can have a look at this as well and there problem might get solved.

  • You should set Cache policy to your NSURLRequest object and check for policies that ignore cache data, see the documentation.

  • Since you have a call to release in your code i assume you are using ARC, so why you do not call [super dealloc] in viewDidUnload()?

  • Have a look at this thread for how to cleanForDealloc using UIWebView.

  • Is it a UITableViewController ? with a custom cells ? Try deallocating (release, removeFromSuperView, set to nil) them as well.

Hope it helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!