开发者

GlBufferDataARB is giving me memory issues

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 开发者_StackOverflow中文版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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜