in this tutorial, after switch models for many times the memory is grow quickly, is there any way to fix it?
https://threejs.org/examples/webgl_loader_gltf.html
Confirmed on Windows 10, Chrome Version 64.0.3282.71 (Official Build) beta (64-bit).
RAM usage is steady about 120mb, but every time I switch models GPU memory use jumps ~200mb.
Pretty soon it gets maxed out and then I get a black screen with the dreaded "Rats! Webgl hit a snag" message.
The issue confirmed.
That example creates a new scene and a new renderer when switching model.
I speculate old resources aren't disposed correctly.
I'll look into later...
I wonder if we should simplify the glTF examples... right now they鈥檙e more unit tests than anything else, and not a very helpful reference for developers... opened https://github.com/mrdoob/three.js/issues/13041
Closing this in favour of #13041
I confirmed that main source of the issue is old resources aren't released.
Probably it wouldn't be better to switch model in an example, releasing all unnecessary resources with .dispose() while running application is a bit complicated for users as an example.
So, I think #13041 is one of the best ways for us.
(But I'm still wondered why old WebGLRenderer instance isn't automatically released... who holds the reference?)
BTW I found one minor feedback about resource management, I'll make PR later.