I'm developing a WebGL application for web and mobile. I often use hard-refreshs to test the results of my WebGL implementation. After a view tries, I get the error:
Error: WebGL: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.
This does not appear on a fresh started browser, but after refreshing the site multiple times. I guess the WebGL contexts are not finished, released, destroyed, cleaned up, freed correctly.
How can I do this?
Khronos Group created a test suite for freeing and garbage collecting WebGL context here: https://www.khronos.org/registry/webgl/sdk/tests/conformance/context/context-creation-and-destruction.html (Note: This might crash your browser!)
The test runs through with PASS and TEST COMPLETE, so basicly the test does not detect any issues. However, opening the JavaScript console, it reads 33 instances of:
Error: WebGL: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.
Is this a bug in how WebGL is handled by the browser? Or am I doing anything wrong? I never thought about freeing any WebGL contexts.
I'm using Firefox Developer Edition 48.0a2 and Firefox 46.0.1.
How to free and garbage collect a WebGL context?