最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Multiple detached webview instances seen in chrome devices while navigating in hybrid android app - Stack Overflow

programmeradmin2浏览0评论

We have an hybrid android application. I am trying to navigate from a WebView to a Native context back and forth. Using chrome://inspect/#devices I get to notice that multiple instances of device inspected are detached while one of all would be attached as displayed in chrome. Referring to SO-28254614, now I have not developed the WebView though, but to what I know about our application the WebView are not designed using Cordova and are in JS. An the question that I have are :

  • Why is it so that we see these detached devices on chrome?
  • Could this be a possibility of a leak in Android WebView?

We have an hybrid android application. I am trying to navigate from a WebView to a Native context back and forth. Using chrome://inspect/#devices I get to notice that multiple instances of device inspected are detached while one of all would be attached as displayed in chrome. Referring to SO-28254614, now I have not developed the WebView though, but to what I know about our application the WebView are not designed using Cordova and are in JS. An the question that I have are :

  • Why is it so that we see these detached devices on chrome?
  • Could this be a possibility of a leak in Android WebView?
Share Improve this question edited Jan 15, 2019 at 16:06 Sunny R Gupta 5,1361 gold badge32 silver badges41 bronze badges asked Dec 5, 2015 at 7:11 NamanNaman 32.2k31 gold badges238 silver badges376 bronze badges 2
  • 1 Are you experiencing a performance promise while you are browsing in your app's WebView? Here are the Google Docs regarding memory leaks: developers.google./web/tools/chrome-devtools/profile/… Probably won't help, but this is an umbrella bug for eclipse regarding issues with detached web view. bugs.eclipse/bugs/show_bug.cgi?id=276221 – simsketch Commented Dec 16, 2015 at 8:02
  • 1 @ElonZito Performance of webviews are paratively slower in respect to the native context. Would follow the performance checks and keep an eye on the Bug. – Naman Commented Dec 16, 2015 at 14:02
Add a ment  | 

1 Answer 1

Reset to default 4

So the way these web inspectors work is that they use the RemoteDebug Protocol.

This protocol defines the various messages and mands that are exchanged to let you 'inspect' your pages.

One instance of the inspector can only connect to one client at a time. So assuming that you are switching to and fro web-views and native context, you are basically spawning new webviews for every new context switch.

This would indicate that the previously opened webviews are now 'orphaned' and for all practical purposes detached.

You can try to inform the VM that a webview is no longer in use by calling destroy() on the webview to let the garbage collector know it is no longer required.

Hope this provides a deeper understanding on what is happening behind the scenes.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论