PDA

View Full Version : VAO deleting causes strange memory problems



ibequa
04-30-2016, 10:07 PM
I have a render cycle looking like this: import model -> draw it (some frames...) -> delete it. To draw the model I'm using vao/vbo/ebo.

Now, in a delete stage with this code:


glDeleteVertexArrays(1, &vao);
glDeleteBuffers(1, &vbo);
glDeleteBuffers(1, &ebo);

while profiling in Xcode Allocation instrument, I get this:

2262

whereas if the code is written like:

glDeleteBuffers(1, &vbo);
glDeleteBuffers(1, &ebo);
glDeleteVertexArrays(1, &vao);

suddenly it shows:
2263

Why is this happening? I change nothing but the order of glDeleteVAO / glDeleteBuffers and getting this strange 'memory leaks'. All these 3 lines of code are placed in the dctor and are not distributed across the app.

Also, glIsBuffer() after deleting vbo, vao, ebo returns 0 in all these cases on all buffers.

using opengl 4.1 on os x el capitan

mhagain
05-01-2016, 06:42 AM
This is a common misunderstanding.

glDelete* calls do not make any promises about freeing memory. They are specified to make the names available for reuse, but the driver is free to actually release the backing memory at any arbitrary later time. It's in-spec for a driver to release the memory immediately, but it's also in-spec for a driver to keep the memory allocated so that it can be used to quickly satisfy a hypothetical future requirement.