How to reduce memory usage or avoid out-of-memory errors?

3D WebView utilizes a browser engine, and sometimes on mobile platforms (Android, iOS, UWP), that can push the app over the maximum amount of memory allowed by the system. If you encounter that issue, here are some tips for reducing memory usage:

  1. You can use Application.lowMemory to detect when the app is running low on memory and then free up unneeded resources in response to that. Some ideas for freeing up memory are:
    • Closing unneeded webviews.
    • Reducing the size or Resolution of webviews.
    • Unloading unneeded resources in Unity.
    • If you're viewing a web page that has loaded many images or videos, potentially navigating to a different page.
  2. You can pause unused webviews by calling IWebView.SetRenderingEnabled(false).
  3. If some webviews are being used to show static content that doesn't change, you can call IWebView.CaptureScreenshot() to get a static image to display on a Quad so that you can destroy the webview.