🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Lesson 32 memory leak?

Started by
1 comment, last by lc_overlord 17 years, 11 months ago
Recently I encountered a bug while trying to release the image data that was loaded in a slightly modified LoadTGA function from Lesson 32 of Nehe's tutorials. So I went back to the tutorial, read it over again, downloaded the code, and then tried to find where and how the image data was being released. What I found was the image data is released fine if an error occurs during the initial memory allocation, but if allocation is successful, where and how does the memory get released??? Download the code yourself and see if you can find a 'free' function outside of the LoadTGA function. My only other thoughts on this were that somehow GL or the MM somehow magically released the memory on shutdown. Any good insight to this problem will probably help me fix the nasty exit bug I'm running into.
Advertisement
The image data stored in system RAM is freed but I don't think there is a way to unload a texture from VRAM.

So, in short, I don't believe there's a memory leak there. My engine does it the exact same way. I'd be interested in seeing if there is a way to unload a texture from OpenGL completely.
The memory isn't freed by the program at least (though it should be), perhaps the system will do that, who knows.

You can free a texture from vram using the command glDeleteTexture.
Look a few posts down in where i explain it in detail.

This topic is closed to new replies.

Advertisement