I made a small game in iOS where VBO, IBO, and VAO are created on stage whenever a new model is loaded. When the model is no longer necessary, those buffers are freed.
The buffer creation and destruction is always done at the beginning of the rendering loop (I have a single thread, with frame skipping in the game loop).
I used to use only VBO and VAO and it never crashed before, but when I added index buffer objects, IBOs, I suddenly started getting these crashes.
If I don't free the buffers, it doesn't crash, so I guess the model is still being rendered and erasing the buffer makes it crash? But how can that be if I have a single thread? Btw, I do not erase the data, though. All the vertices and indices are static.
This is the code where I free the buffers, which is called when there are no references left of a particular model:
void ResourceModel::DeleteBuffers(uint16_t modelId)
{
glDeleteBuffers(1, &m_buffer[modelId]);
glDeleteBuffers(1, &m_bufferIBO[modelId]);
glDeleteVertexArraysOES(1, &m_geomVAOs[modelId]);
glDeleteVertexArraysOES(1, &m_primVAOs[modelId]);
}