'How to find memory usage for android webview

Objective is to find memory usage for android webview

We use 2 ways to measure memory usage.

  1. Chrome developer tools:record performance - This gives JS Heap
  2. dumpsys meminfo : This gives memory usage of the Foreground app and webview separately

Observations:

  • open webapp measure memory by dumpsys meminfo.
  • output of meminfo has 2 entries in Foreground, one for App and another for webview.
  • when we start using app we can see increase in both app and webview memory

Queries

  • Does app memory includes webview memory(It should not bcoz both are different process) ?
  • If the game is loaded in webview then why app memory increases ? we can see details of graphics/Native/Heap memory under both webview and app process memory details
  • what memory allocation happens via app process and webview process
  • As a developer do we need all data(JSHeap from Chrome devtool , webview and app memory from dumpsys meminfo) to debug/fix memory issues


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source