We are looking into this issue.
Would using the NativeArray collections for temporary data be an alternative for you? They are a thin wrapper around a buffer of native memory and do not use Garbage Collection. Instead you can immediately free their memory using the Dispose() method. They also offer control over the allocator so you can allocate memory with different lifetimes.
Hi, thanks for looking into it.
We already optimized largest RAM allocations using NativeArray. Also optimized max RAM usage by a lot. I found this bug by accident when testing GC API on web builds.
But the project is huge and it is impossible to track and optimize everything at this stage.
In some cases reducing total RAM usage means we use lighter pooling setup that causes more allocations overall, which probably triggers this GC bug even more.