WKWebView memory accounting

I recently noticed a very large drop in reported/profiled memory consumption for an app when migrating from UIWebView to WKWebView.


I suspect that the memory being consumed by WKWebView is not showing up as memory used by the app and is therefore perhaps running in another process?


Does anyone know if memory consumed by WKWebView is considered by the OS as used by the app, and therefore contributes to the figure which might give rise to a memory warning or cause the app to be evicted from memory in the background?


This would be a significant advantage over UIWebView if so and a good motivator to press through the other specific problems I am experiencing with WKWebView and the migration.

Accepted Reply

Hi tenermobile

Yes, WKWebView performs all of its work out of process and its memory usage is accounted for seperately from that of your app. While its possible that the WKWebView process could exceed its memory budget, doing so would not cause your app to be terminated and should at most result in a blank view.

Replies

Hi tenermobile

Yes, WKWebView performs all of its work out of process and its memory usage is accounted for seperately from that of your app. While its possible that the WKWebView process could exceed its memory budget, doing so would not cause your app to be terminated and should at most result in a blank view.

Thanks Justin - that's very useful insight. Is there a way I can detect the WKWebView process being terminated and re-create it? The web view is very important in this app and a blank view would be very bad.

The performance issue in iOS 9 seems to be related to a bug in Safari. Whether you are using Safari, UIWebView or WKWebView...you will notice a hit in performance every time you select a text input field. I created a basic html page with 100 text inputs...and as I traverse through the inputs a few times, the app eventually becomes unresponsive to gestures. The only solution in Webview/Webkit (that I am aware of) is to restart the app. Is there another way to systematically restore the performance of the app without the need to force close and re-launch?

(To justin)
Hi,Justin I have been facing one problem with WKWebView offcourse as well UIWebView.I am Loading the Interactive meeting url on webview,so that interactive buttons on the webview has to work properly and the same loading has to be done 365 days.But the problem is memory is increasing very high in UIWebView and we have replaced that to WKWebView,here also memory increasing but better than UIWebView.
please help us to Maintain the memory.We don't know what exactly the reason of increasing memory,please tell us.

Same issue here. Any solution?

I've got the very same issue. Has anyone found a workaround at least?

Also would like to know. The info from task_vm_info_data_t is the same as the Xcode debug tool. But the WKWebview process isn't there as my WKWebview hits large limit and self-terminates (due to memory we believe)

Thx