On Windows machines, our game runs within a “Desktop Application” that uses WebView2 and CEF as a fallback if the user doesn’t have WebView2 installed. A 64-bit and 32-bit version of the “Desktop Application” is available for download (32-bit is the default download).
Our game runs fine within the 64-bit version of WebView2 and CEF and the 32-bit version of WebView2. However, our game crashes on load within the 32-bit version of CEF.
The max available JS heap within CEF is 1GB. Our initial thought was that the Unity Heap couldn’t grab a big enough chunk of contiguous memory, so we set an initial allocation of 256MB and pass it to the Unity instance of our game. But it still crashes. We have also tried smaller initial allocations (64MB and 128MB).
The crashes occur during the loading of the .wasm and .data files (most of the time). Occasionally, it successfully loads both the .wasm and .data files and our game begins to download Asset Bundles. It then crashes while loading one of our Asset Bundles.
In the case of crashing on .wasm/.data files it crashes on failing to allocate a Uint8Array for the response in WebGL.loader.js:
resolve(new Uint8Array(xhr.response));
The .wasm and .data allocations are 32MB and 21MB respectively.
In the case of crashing on loading our Asset Bundles it crashes in WebGL.framework.js on _malloc:
if (byteArray.length != 0) {
var buffer = _malloc(byteArray.length);
In both instances, there seems to be plenty of JS heap available (according to memory snapshots and console logging with performance.memory.usedJSHeapSize and performance.memory.totalJSHeapSize).
We have tried disabling/enabling Web Assembly streaming and disabling/enabling gzip compression.
We are using Unity 2020.3.1.
Any ideas on what could be the cause of our memory issues or tips on further debugging?
EDIT:
After seeing a release note in 2020.3.9
We attempted to build using the latest LTS version 2020.3.16, but no change