Get current WKWebView memory usage?

In the application I'm currently developing, I have a requirement to monitor the use of WKWebView in memory. I can’t figure out how to do this. Since WKWebView works separately from the main application, therefore, obtaining diagnostics in the main application does not reflect WKWebView.

Has anyone done this before?

It seems that on iOS 9 you simply cannot look at other running processes. So this option is missing. However, I'm still not sure if WKWebview is another process? I notice when starting a new WKWebView, it creates new threads under mach_task_self. Thus, this means that WKWebView is not really a separate process, but in the same / mach process as the main application. But the memory is in a different address space.

Is it possible to somehow capture a separate WkWebview memory space using low level mach and posix methods?

Or is there any other way to access WkWebView memory?

+5
source share
1 answer

In Xcode, select "Product" and then select "Profile", after compilation it will open the Tools.

Select Activity Monitor and press Select .

enter image description here

Click the red circle in the upper left corner to start profiling.

enter image description here

Try to find a process called "com.apple.WebKit", the column "Real Mem" is what you wanted.

enter image description here

+1
source

Source: https://habr.com/ru/post/1246903/


All Articles