My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles.

At the moment, I create two VBOs for each chunk (vertices and colours), when the chunk is loaded. Once a mesh is created, it is only edited every few seconds. These buffers are deleted when the chunk is no longer visible.

Am I leaking memory here by constantly creating and destroying buffers?

I've heard somewhere that OpenGL (or WebGL in this case) doesn't do garbage collection until the program quits, due to it being slow. Is this right?

Could I improve this system somehow?

  • \$\begingroup\$ As far as I know, glDeleteBuffer should work fine, as long as you VBO is not bound to a VAO. \$\endgroup\$
    – PSquall
    Commented Jul 3, 2017 at 10:33

1 Answer 1


deleteBuffer will delete the buffer in WebGL (and OpenGL) but I'm just curious, is there any reason not to just reuse the same buffer just put new data in it? (eg. have a pool of buffers?)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .