Are WebGL objects garbage collected?
WebGL objects like Buffers or Textures are associated with a memory block on the GPU as allocated by
Note that underlying GL object will be automatically marked for deletion when the JS object is destroyed
But you should notice that the object would probably not destroyed at the time you give up the last reference, so it's still a good practice to call
Copied from this answer: Are WebGLTextures garbage collected?
with the word
Yes and no.
WebGLObjectobject is a tiny object that just contains an
WebGLObjectobjects in order to free up texture memory. It's only looking at CPU memory.
This is actually a well known problem of garbage collection. It's great for memory. It's not so great for other resources.
WebGLObjectobjects are garbage collected and yes the texture/buffer/renderbuffer/program/shader will be freed but practically speaking you need to delete them yourself if you don't want to run out of memory.
Of course the browser will free them all if you refresh the page or visit a new page in the same tab but you can't count on the browser to garbage collect
WebGLObjectobjects (textures/buffers/renderbuffers/programs/shaders) in any useful way.