New issue
Advanced search Search tips

Issue 694711 link

Starred by 2 users

Issue metadata

Status: Archived
Owner: ----
Closed: Apr 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

WebView leaks memory on big WOFF2 fonts.

Reported by oversoft...@gmail.com, Feb 21 2017

Issue description

Steps to reproduce the problem:
1. Load a page with big (1MB+) WOFF2 embedded webfonts.
2. Reload page a bunch of times.

(Example page: https://spiqle.com/test/memoryleak/ )

We're using a webview in our app to show content to the user. The webview loads a new page often (every 20 or 30 seconds). When using pages that contain big webfonts, memory seems to be leaking at a high rate. The example page above leaks about 20MB each time it reloads.

Swapping out the used fonts with much smaller fonts (for example the Calibri font hosted by Google, which are only 33kb a piece) seems to completely solve the problem.

For some reason, the memory leak seems to be much, MUCH bigger when the page contains a big image with a non-zero opacity (as in the example page). It doesn't matter if the image is a bitmap (PNG) or an SVG. (I've commented out the PNG In the test page, you can easily add it back in and remove the SVG).

We're running on an Odroid XU4 (which is based on the 32-bit Exynos 5422). On both Android 5.1.1 and Android 7.1 with the latest Android System Webview (and in the case of Android 7.1: Google Chrome set as a WebView), this issue exists.

On Android 5.1.1 this causes an app crash within 10 to 15 minutes if the page has reloaded every 15 seconds. (You can see the amount of free memory dropping by running "free" on the adb shell)

On Android 7.1 this triggers multiple garbage collections by the ActivityManager every 20 minutes or so and crashes the app after about an hour with an OOM error.

On the Odroid C2 (which is based on the 64-bit Amlogic S905 and has the same amount of RAM (2GB)) running Android 5.1.1, this problem does not trigger a memory leak. We can run our app happily all day long with the same page without a single crash.

This issue was reported in bug:  693069 
But since the topic start was not accurate anymore (i've pinpointed it to a completely different cause), a new bug has been posted here.

I don't know if it helps, but i attached a 7-zipped performance profile i've taken via chrome://inspect on the attached PC via ADB. It doesn't show an increase in memory though. (I've connected over ADB shell and am running "while [ 1 ] ; do free ; sleep 1 ; done" to keep an eye on memory usage)

What is the expected behavior?
No memory leaks, no crashes

What went wrong?
The app crashed

Crashed report ID: No

How much crashed? Whole browser

Is it a problem with a plugin? No 

Did this work before? No 

Chrome version: 56.0.2924.87 WebView  Channel: stable
OS Version: 7.1
Flash Version: 

I'm able to quickly compile and test WebView builds locally and if required can give remote access to the Odroid XU4 and C2.

 
logcat.txt
1010 KB View Download
Profile-20170220T132943.7z
3.1 MB Download
Components: Mobile>WebView
Components: Blink>Fonts

Comment 3 by e...@chromium.org, Feb 21 2017

Components: -Blink>Fonts Blink>WebFonts
The arm is listed as x86_64, but it should be armv7 (32 bit).

Comment 5 by aluo@chromium.org, Feb 22 2017

Labels: -Arch-x86_64 Arch-ARM Needs-Bisect M-58

Comment 6 by boliu@chromium.org, Feb 23 2017

Does this reproduce in chrome? Can you take an "memory-infra" trace of when memory is bloated, instructions here: https://chromium.googlesource.com/chromium/src/+/master/docs/memory-infra/

From the attached trace, there's a whole bunch of WorkerPool threads that just seem to grow without bound, maybe that's the leak.
I'll try a memory-infra trace on Chrome tomorrow. Is there any way to start Chrome on Android with the no-sandbox flag?

Comment 8 by boliu@chromium.org, Feb 23 2017

no, that requires recompilation

fwiw, memory-infra should work on webview as well, if you have a userdebug device, or can modify the app to enable webview debugging: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews
I know, that's how i got the first performance profile. ;)
I'll run one on the Webview and one one Chrome today.
I'm unable to grab a memory-infra trace from the box. Neither in WebView or in Chrome.
When i try to record a trace on my desktop PC, Chrome crashes (on the desktop, the Android box continues to run).

Comment 11 by boliu@chromium.org, Feb 24 2017

I think you need to make sure your desktop chrome version >= android chrome/webview version.
I'll try again on monday. I think my desktop Chrome was the latest version, but i'll grab my laptop to see if that makes a difference. I'm running over adb over network instead of USB, i don't know if that matters. (The XU4 doesn't have a USB OTG port)
Labels: Needs-Feedback
Project Member

Comment 14 by sheriffbot@chromium.org, Apr 6 2017

Status: Archived (was: Unconfirmed)
No feedback was received in the last 30 days from reporter "oversoft.nl@gmail.com", so archiving this. Please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment