- Home /
WebGL unallocated heap space
Hello,
I need to know the unallocated heap space in a WebGL application. I want to avoid the user to add a new element to the scene if the available memory is not enough. I want to avoid the web to send an error message and crash.
I use GetTotalMemorySize(), GetTotalStackSize(), GetStaticMemorySize() and GetDynamicMemorySize() to do the calculation, but the result is inconsistent because of the Garbage Collector. I guess.
I get as a result: 260MB, 40MB, 200MB, 145MB, 100MB, 40MB, 160MB, 120MB,...
I tried to call GC.Collect(), but the result is the same.
Any ideas on how to do this?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612182228im_/https://answers.unity.com/themes/thub/images/avi.jpg)