Detect available memory inside of a WebView Detect available memory inside of a WebView google-chrome google-chrome

Detect available memory inside of a WebView


I have discussed this with the Chromium team and the Android team and at the moment (they think and I believe them) that this is impossible.

Sometimes, the amount of required memory exceeds the amount JavaScript can require and crashes the Chromium process of the WebView which crashes my app.

You can however catch out of memory crashes in Android 8.0+ using the new termination handle API. So this works around my problem by not having to check the available memory required in the first place.

By overriding onRenderProcessGone - we get to catch the bug and recreate the WebView.