- Home /
WebGl memory out of bounds during play.
Getting this error when playing the application on webGL mobile. It works with high end phone with 8gb ram but keep crashing on mid to low end phone (6gb and 4 gb ram phone). No problem on computer browser. The error is either WebGL: RuntimeError: memory access out of bounds. Or Could not allocate memory: System out of memory!
Anyway to fix this? Been searching for solution for a week. unity version 2021.3.0f1. I am also using addressable to reduce the memory usage but it still crash.
error log from chrome:/inspect .
Could not allocate memory: System out of memory!
Trying to allocate: 5592404B with 16 alignment. MemoryLabel: Texture
Allocation happened at: Line:69 in
Memory overview
[ ALLOC_TEMP_TLS ] used: 32768B | peak: 0B | reserved: 4194304B
[ ALLOC_DEFAULT ] used: 37931833B | peak: 81018660B | reserved: 39058970B
[ ALLOC_TEMP_JOB_1_FRAME ] used: 0B | peak: 0B | reserved: 262144B
[ ALLOC_TEMP_JOB_2_FRAMES ] used: 0B | peak: 0B | reserved: 262144B
[ ALLOC_TEMP_JOB_4_FRAMES (JobTemp) ] used: 0B | peak: 0B | reserved: 786432B
[ ALLOC_TEMP_JOB_ASYNC (Background) ] used: 0B | peak: 0B | reserved: 1835008B
[ ALLOC_GFX ] used: 62642704B | peak: 62694208B | reserved: 62652736B
This error happened to me due to using the dynamic keyword. After replacing all my dynamic types with object the error was gone. Apparently the dynamic keyword is not supported on WebGL builds. ePayitonline
thanks for the reply, but I am not using dynamic at all so might be different problem.
Narrow down the line of code that crashes WebGL. Go through the painfull process of pinpointing the line of code that is the source of the error. I had this "luck" that error occured when I've hit button and tried to load UIScene in Addition mode. So at first I found the script in the scene which when disabled got rid of the crash. Then I've repeated the steps and digged deeper into lines. After 2 hours of builds, comments etc I've found that the code was not working was setting the new color for UnityEngine.UI.Image. Which was pretty weird because in playmode everything worked ok.
I tried to narrow down the line code that make it crashes. It seems that the code crash differently depending on the mobile phone specs.
Your answer

Follow this Question
Related Questions
WEB GL optimization checkbox level disappeared from Build settings in 5.4? 1 Answer
How can I get a string to work as the key to a dictionary filled with the text of a www object? 0 Answers
Virtual Joysitck for WebGL???? 0 Answers
WebGL build crashes but game runs fine in editor and windows build. 0 Answers
WebGL: Interacting with browser scripting unable to call java script method from C# 2 Answers