Memory issue on Chrome(since 62/65) in Android 7.0

146 views
Skip to first unread message

xuan long

unread,
Mar 7, 2018, 4:25:11 AM3/7/18
to android-webview-dev
Hi, guys,

     Why in Chrome version 62/65,  load webview with javascript cost more memory?
     As a example, load three webveiw with javascript below at same time,
<script>
 for(var i=0;i<100000;i++) {
    console.log("Hello, World!");
 }
</script>

    Then in Chrome 44/45, memory cost is 100M, but in Chrome 62/65, 1000+M is costed,  this really a huge gap on memory usage.
    The problem above is from the issue https://groups.google.com/forum/#!searchin/google-admob-ads-sdk/chrome%7Csort:date/google-admob-ads-sdk/I6giN0VbVa0/9JKoo-m3BwAJ  we suffered since last year, and we can sure Chrome 62/65 have memory issue in Android 7.0+ but not in Android 8.0.
Anyone can explain what happened on Chrome these versions and how to solve this issue, thanks.

Regards,
Chunyu

yang zhengang

unread,
Mar 7, 2018, 6:56:28 AM3/7/18
to android-webview-dev
hi, guys

When i load 3 webview with sample javascript at the same time,
code like this:

<script>
for(var i=0;i<100000;i++) {
  console.log("Hello, World!");
}
</script>

for (int i = 0; i < 3; i++) {
    WebView webView = new WebView(this);

    WebSettings webSettings = webView.getSettings();

    webSettings.setJavaScriptEnabled(true);
    webSettings.setDisplayZoomControls(false);
    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setDomStorageEnabled(true);
    webSettings.setSupportMultipleWindows(true);
    webView.loadUrl("file:///android_asset/js.html");
}

Mobile:galaxy s6 edge
model:SM-G925F
system: 7.0
Android System WebView: versionCode: 288309150 versiontName: 55.0.2883.91

When i run this sample,i found it cost about 1G memory rapidly






Mobile:Nexus 6
model:MOB31E
system: 6.0.1
Android System WebView: versionCode: 332514450 versiontName: 65.0.3325.144

When i run this sample,i found it cost about 1G memory rapidly

but change Android System WebView to : versionCode: 246011700 versiontName: 44.0.2403.117
it only cost about 10M

So,i test the Android System WebView from 44 to 65,i draw below conclusion.
1. Between webview version 44 and 52,on nexus 6 system 6.0.1,memory cost is normal.
2. Between webview version 53 and 57 on nexus 6 system 6.0.1,memory cost is high,but grow slowly.
3. Between webview version 55 and 57 on galaxy edge system 7.0,memory cost is high and grow very quickly.
4. On webview version 58 on nexus 6 system 6.0.1,memory cost is normal.
5. Between webview version 59 and 65 on nexus 6 system 6.0.1,memory cost is high and grow very very very fast
6. When i test on system 8.0,use webview version 62 and 65,mobile sony and huawei,memory cost is normal

I hope this code and test case can help to make chrome better, and fix the chrome  memory bug when load bad js.
Thanks!


xuan long於 2018年3月7日星期三 UTC+8下午5時25分11秒寫道:

ct...@chromium.org

unread,
Mar 7, 2018, 1:59:38 PM3/7/18
to android-webview-dev, yangzhe...@gmail.com
Could you please file a bug https://goo.gl/9qkbdn

yang zhengang

unread,
Mar 7, 2018, 10:25:06 PM3/7/18
to android-webview-dev, yangzhe...@gmail.com, ct...@chromium.org
Thanks,I have already reported the issue on webview bugs of chromium.
https://bugs.chromium.org/p/chromium/issues/detail?id=819901

ct...@chromium.org於 2018年3月8日星期四 UTC+8上午2時59分38秒寫道:
Reply all
Reply to author
Forward
0 new messages