In my app when i load UIWebView
with any Website url the memory jumps from 30mb to around 140mb.
I am using ARC
and when dismissing the UIWebViewController
[Viewcontroller
which contains UIWebView], it doesnt releases the memory.
Can any body help me how to solve this memory issues as well as please also provide me pointers of memory bestpractices in ARC
For loading the webpage :-
NSURL *nsurl=[NSURL URLWithString:self.url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview loadRequest:nsrequest];
FOr Dismissing the Viewcontroller:-
[self dismissViewControllerAnimated:YES completion:^{
webview.delegate=nil;
webview=nil;
}];
Thanks in Advance :)
I was having the same problem in my application. I would recommend that you should use WKWebView. WKWebView was introduced with iOS 8. You can read more about it here apple documentation
The memory issue is definitely solved. You will get all the functionality from webview and some more(i.e. progress). Hope this helps
Don't listen to them,
Its not a problem, phones can handle all that memory usage, try using an MKMapView and watch your memory usage soar.
In your simulator, try putting through a low memory warning
cmd+shift+m
, and see what happens, you can't expect all web views to run at the same memory usage, also, you have give a chance for your phone to buffer it all out.iPhones can handle all of that, so you shouldn't worry much about it.
But try this anyway:
The behaviour of UIWebViews changes if you uncheck "Detects Links" in the nib file, so try toggling that and see what happens.
If you want to reduce the memory usage of UIWerview immediately, you can try:
1.
or
2.
or
3.
It worked to me.