I’m occasionally running into an out of memory error in my WebGL Unity app when users load too many models.
Is there any way to catch this? I put a try/catch around the offending line (followed by a Dispose) but not seeing any sign of the exception.
Alternatively, is there any way to get more fine-grained memory usage info? In particular, seeing the ALLOC_GFX stats (used/peak/reserved) would be very helpful.
Could not allocate memory: System out of memory!
Trying to allocate: 3576616B with 32 alignment. MemoryLabel: VertexData
Allocation happened at: Line:261 in
Memory overview
[ ALLOC_TEMP_TLS ] used: 32768B | peak: 0B | reserved: 4194304B
[ ALLOC_DEFAULT ] used: 181916731B | peak: 181916731B | reserved: 185270364B
[ 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: 1835008B
[ ALLOC_TEMP_JOB_ASYNC (Background) ] used: 0B | peak: 0B | reserved: 1310720B
[ ALLOC_GFX ] used: 1799404755B | peak: 1799404755B | reserved: 1799471103B
[...]
$MemoryManager::Allocate(unsigned long, unsigned long, MemLabelId, AllocateOptions, char const*, int) @ [...]
22:59:17.706 instrument.js:107 Unity error: exception thrown: RuntimeError: table index is out of bounds,RuntimeError: table index is out of bounds