View Full Version : Memory Loss !!

04-10-2001, 05:31 AM
I have a very annoying problem.

I am generating a texture with:

and then creating mipmaps using

The problem is that every time i call the function to perform this, the program gets slower and slower and uses up more and more RAM until the computer eventually dies. I have tried glDeleteTextures(1,&texture[0]) to free the memory storing the texture but this doesnt seem to work either.

Could someone please tell me how i can free this memory.


04-11-2001, 11:45 PM
Are you calling glGenTextures at each frame ? If you are you should only do it once to create your texture object and then only use glBindTexture. Sorry if I'm saying something you already know http://www.opengl.org/discussion_boards/ubb/smile.gif.

[This message has been edited by Olive (edited 04-12-2001).]

04-15-2001, 12:26 PM
Is the rendering context current when you call glDeleteTextures?

04-15-2001, 02:54 PM

I'm assuming that you are using gluBuild2DMipmaps in a fashion similar to this:

gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB8, texture.width, texture.height, GL_RGB, GL_UNSIGNED_BYTE, texture.imageData);

...where texture.imageData is a pointer to the actual image data itself. Make sure that after you are done building the mip levels with the above texture function that you are calling free(texture.imageData) or delete depending on the convention you are using to load the texture file into memory.

Not freeing this memory will lead to a memory leak that could be the root cause of your problem.

My 2 cents...