Hello everyone I have a problem with Out of memory. The application works stably and generates such an error after some time.
Textures on models have a native resolution of 512x512px, no dynamic shadows, no smoothing edges. After running the application takes about 97MB Webgl Memory, after some time it throws me anyway a memory problem.
There must be something in your code that add to the memory while the application is running.
That could be a problem of garbage collection… you can resolve that in two ways:
reload the scene (everytime you do that the memory is cleaned)
try with System.GC.Collect(), as far as I know, this command is now supported even in WebGL, but I don’t know since which versions ( @Marco-Trivellato can help explaining that! ^_^)
GC.Collect() is supported as of 5.6
Though, it’s behavior is slightly different compared to other platform: the garbage collection won’t happen immediately, instead it will be postponed to the beginning of the next frame. Good enough for most use-cases, I think.
as @DudoTheStampede mentioned, that seems to be a problem with your code since you are running out of memory inside the Unity Heap. I suggest you launch your content with the profiler attached and take a look at memory consumption in the profiler.