Jump to content
  • Advertisement
Sign in to follow this  
Prodigal_Son

How To Free Memory After Using auxDIBImageLoadA

This topic is 4996 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I'm new in programing Games in OpenGL! I have some work to do, a game for my graduating in university! In the game enviroment I use a lot of Images. I reserve memory for the images with auxDIBImageLoadA, but when I debug my program the is a memory leaks for all the images! I try to free the reserved memory with free( void* ) and with delete, but the leaks are still there. Please if somebody know how to free this memory, let me know. Something important, i use for the images ::glGenTextures( GLsizei n,GLuint *textures ), ::glBindTexture( GLenum target, GLuint texture ),::glDeleteTextures( GLsizei n,GLuint *textures ), to create texture objects in memory, after this i put all the generated texture objects in a single DisplayList. After all work i first delete the displaylist with textures, delete memory texture objects and last i try to free the pointers AUX_RGBImageRec *m_pRGBImage[MAXCOUNTTEXTURES] that were used for the auxDIBImageLoadA for every image...but no result. One more (LAST) quastion, I suppose that this memory is a VIDEO memory (if i'm not right please let me know) of the video card, so is this memory defragment from OS, (i.e. if we don't free the memory is there a possibility to overflow the memory, for example if i run my program many many time without restart the computer). I ask this because before i don't delete the display lists for my objects and after several runing of the program some of the objects are not with the exact dimensions. Thank you very much.

Share this post


Link to post
Share on other sites
Advertisement
Hopefully someone else can chime in here, but I'll give it my best shot. First of all the aux libs are deprecated, so look into another image loading mechanism (DevIL is great). Second of all, make sure you are deleting the image, as well as the struct, e.g.

free(dib->data); // I think it's called data, whatever the image member is...
free(dib);

I haven't seen much documentation on how to clean up after it, so I'm actually unsure if you should use free or delete (delete [] dib->data; delete dib;), but I'm fairly certain you should use free. It's a C interface, so I believe it's reasonable to expect to free the memory with C STD lib calls.

Share this post


Link to post
Share on other sites
Ill give you something about glaux, don't use it. The OpenGL Auxiliary Library (GLAUX) was developed by SGI in the 90s for test programs, and somehow worked itself around the internet, since then it has been abbandonned by SGI, and numorous memory leaks have been found, just dont use it, BMP and TGA loaders are easy, and if you dont wanna do that, you can use SDL or DevIL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!