Browser can't open HTML5
I've packaged a project in HTML5, and when opening it with Firefox I get this message:
Range Error: invalid array length
The way I understand this, the bundle of assets is too large for Firefox to handle. The size of the assets is 4 GB. Is there any way to get around this problem? Does it make a difference whether you select or deselect the use of a PAK file, or use file compression? If you need to reduce the file size of the assets to make the presentation work with Firefox, what would be the best way to make the file lighter, and what would be the size of a asset file that does work with Firefox?
asked Sep 28 '17 at 12:30 PM in Using UE4
The maximum array length in Firefox is 2GB - 16MB (2130706432 bytes) for asm.js, and 2GB-64KB (2147418112 bytes) for WebAssembly. Allocating these maximum sizes works only for 64-bit browser. If you are running on a 32-bit Firefox browser, you may be able to get to that ~2GB limit if you use the Large-Allocation header hint on the web server: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Large-Allocation. Make sure you set the Total heap memory to less than these amounts.
Chrome seems to have lower limits from my experience, so what works for Firefox, might still be too large for Chrome. In particular, Chrome seems to sometimes AwwSnap crash, rather than throwing an exception, if one attempts to allocate too large an array. Though this might also be operating system specific.
Firefox is looking at lifting its 2GB restriction even further, see https://bugzilla.mozilla.org/show_bug.cgi?id=1392234.
Additionally, the Emscripten compiler project is working on enabling the new ASMFS filesystem to be used for UE4, which will ultimately remove the asset sizes from contributing to this 2GB limit at all.
If you use a PAK file, and use compression, that should get the smallest sizes, I believe. You can measure that by checking the size of the .data file on disk. Compressing the .data file to a .datagz file does not reduce this limit (since PAK compression already has compressed the size).
answered Sep 29 '17 at 10:49 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here