My project is a hybrid static library for displaying a UIWebView with some JS for managing logic. When I use the 64-bit version and run the demo on iOS 8 / iPhone 6, the memory continues to work up to 30 M or more!
When I use generation in a tool, increased memory usage is almost all of webcore; Does this mean that there are leaks in the JS code? I cannot find a leak when I use Safari to run similar JS directly.
When I free UIWebView, the memory is still not freed; I tested using a distribution tool. There are still some web pages and (not objects) in my memory, what can I do to release them?
- 0JavaScriptCore WTF :: MallocHook :: recordAllocation (void *, unsigned long)
- 1 JavaScriptCore WTF :: fastMalloc (unsigned long)
- 2 WebCore WebCore :: SharedBuffer :: buffer () const
- 3 WebCore WebCore :: SharedBuffer :: data () const
- 4 WebCore WebCore :: ResourceLoader :: didReceiveDataOrBuffer (char const *, unsigned int, WTF :: PassRefPtr, long long, WebCore :: DataPayloadType)
- 5 WebCore WebCore :: SubresourceLoader :: didReceiveDataOrBuffer (char const *, int, WTF :: PassRefPtr, long long, WebCore :: DataPayloadType)
- 6 WebCore WebCore :: SubresourceLoader :: didReceiveBuffer (WTF :: PassRefPtr, long long, WebCore :: DataPayloadType)
- 7 WebCore WebCore :: ResourceLoader :: didReceiveBuffer (WebCore :: ResourceHandle *, WTF :: PassRefPtr, int)
- 8 WebCore WebCore :: SynchronousResourceHandleCFURLConnectionDelegate :: didReceiveDataArray (__ CFArray const *)
I am using the following code.
-(void)createUIWebview{ [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:serviceUrl]]]; } - (void)webViewDidFinishLoad:(UIWebView *)webView { [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"WebKitCacheModelPreferenceKey"]; } -(void)dealloc{ if (_webView.isLoading){ [_webView stopLoading]; } [_webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]]; _webView.delegate=nil; [_webView removeFromSuperview]; [_webView release]; _webView = nil; }
I researched the following links, but they don't seem to solve my problem. Is UIWebview still leaking in iOS 8? And the problem seems not so obvious when I use iOS 6 in iPhone4.
What is the correct way to release UIWebView?
IOS 8 memory management UIWebView
Leaks UIWebView, JS Scavenger and WebCore VMs
Free memory / cookie / cache from UIWebView after closing
source share