ionic-team / cordova-plugin-ionic-webview

Web View plugin for Cordova, specialized for Ionic apps.
Apache License 2.0
487 stars 395 forks source link

Implement onRenderProcessGone to reload the current page #603

Closed chetan-prime closed 3 years ago

chetan-prime commented 4 years ago

I have a long running app that once it loads up scrolls some content continuously for hours. For some reason, the same app works very well with iOS after all possible memory leaks with plugins were identified and fixed. However in Android especially with newer "Sandboxed" Chrome engines 80.x and higher the same app keeps crashing after a few hours due to memory leaks with Chrome itself. I have profiled & debugged the native code, and javascript code. Both are completely within limits. Also with sandbox, there is no way to check how much RAM Chrome itself is using. I have changed the angular code to use the routing URL to resume app if the webview is reloaded after a crash. However the current plugin only supports auto-reload current URL on iOS but not on Android. Can you enable the same logic in Android too using the onRenderProcessGone method ?

This is the relevant log line- 07-30 08:45:48.066 9708 9738 F chromium: [FATAL:memory.cc(40)] Out of memory. size=0

chetan-prime commented 3 years ago

I was able to fix the issues on Android by switching to CSS transformations for scrolling content. This removed wasteful & expensive JavaScript updates for every pixel of scrolling, has also fixed the problem with application stability. No longer require this hack for my app