views:

26

answers:

1

Basically I do something like this:

GenerateLinePoly(Contour[i].DrawingPoints, Contour[i].Outline.OutlineWidth);
     Contour[i].Outline.OutlineSize = OutlineVec.size() / 2;

 glBindBufferARB(GL_ARRAY_BUFFER_ARB,Contour[i].Outline.OutlineVBO);
     glBufferDataARB(GL_ARRAY_BUFFER_ARB,sizeof(GLfloat) * OutlineVec.size(),
         &OutlineVec[0],GL_DYNAMIC_COPY_ARB);

in my class constructor I do GlGenBuffers for all of these and I guarantee that I use GlDeleteBuffersARB in the deconstructor.

The system memory usage goes up as expected. But after destroying the object the memory occupied by thebuffers remains. I don't think this is a memory leak. I call GlDeleteBuffers and it doesn't clear all the memory it uses. Is that normal behavior? What could cause this?

If I only do:

GenerateLinePoly(Contour[i].DrawingPoints, Contour[i].Outline.OutlineWidth);
     Contour[i].Outline.OutlineSize = OutlineVec.size() / 2;

Then my memory is managed perfectly as I would expect.

Thanks

+1  A: 

Man page of glDeleteBuffers

It doesn't say anywhere that the memory should be released immediately. If it's not leaking (which is a driver bug), then i would say that what you're expecting is not happening. The GL implementation is free to do the real deallocation anytime it wants, specially if the resources are still used. Remeber that since the CPU and GPU run in parallel, the GPU might be using some resource while the CPU is doing other things.

Matias Valdenegro