WebGL2 context stays in memory on Safari
Klaasvaak opened this issue · 2 comments
Description
When debugging an issue within my own project I noticed a lot of canvasses stayed in memory in Safari. I clean up most of the canvasses used by threejs by setting them to a size of 1 by 1 so they won't allocate a lot of memory, eventually these also will get cleaned up by the garbage collector.
I noticed the canvas that was attached to the DOM using WebGL2 is also staying in memory. It stays visible in the Graphics tab in Safari and it won't be garbage collected. We have cases in our website where iOS users get a crash, meaning the current browser tab will refresh. This seem to only happen on an iPhone, not on a Macbook and not on an iPhone simulator.
I attached a video the Graphic tab in the threejs examples.
memory-threejs-demo.mp4
Reproduction steps
- Go to https://threejs.org/examples/ in Safari
- Open Graphics tab in the developers tools
- Load some examples
- See the WebGL2 canvasses stay in the Graphics tab
Code
// code goes here
Live example
- jsfiddle-latest-release WebGLRenderer
- jsfiddle-dev WebGLRenderer
- jsfiddle-latest-release WebGPURenderer
- jsfiddle-dev WebGPURenderer
Screenshots
No response
Version
I think any version
Device
Desktop, Mobile
Browser
Safari
OS
MacOS, iOS
Have you considered to report this issue at the Webkit bug tracker instead (https://bugs.webkit.org/)?
It seems this is not a three.js specific issue and fix needs to be done on the browser side.
For reference: https://bugs.webkit.org/show_bug.cgi?id=284281