How to properly dispose of my WebGL context in ord

2019-08-26 08:11发布

This question already has an answer here:

This is a follow up question to this one: Exceeded 16 live WebGL contexts for this principal, losing the least recently used one.

In that question, it was found that this error happens when you refresh a webGL tab more than 16 times (or collect 16+ contexts across multiple tabs).

However it is not clear how to dispose a WebGL context so that the browser can free up one of the 16 slots for another WebGL context to be able to go there?

标签: webgl
1条回答
欢心
2楼-- · 2019-08-26 08:58

If that's still happening it's a browser bug and you should file a bug. Refreshing a webpage should free all resources. There is no official way to dispose of a WebGL context just like there's no official way to dispose an Image or a <video> or pretty much anything else in JavaScript.

See: How to free and garbage collect a WebGL context?

Note the WebGL Conformance Tests create thousands of contexts

https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html

On top of all the contexts created in the 1000s of tests there's a few tests specifically about lots of contexts including this one, this one, this one, and this one

So whatever issue you're seeing you probably need to post a repo.

查看更多
登录 后发表回答