PDA

View Full Version : Memory problems



B. Jacob
06-11-2001, 11:28 PM
I am using GLUT and auxDIBImageLoadA and I am thinking on some problems about memory management :

1. I use exit(0) to exit form glutMainLoop. But does it really delete the Rendering Context ? Should I better use CloseWindow ?

2. I initialize my texture by :

AUX_RGBImageRec *texture = (AUX_RGBImageRec *) NULL;
... ....
texture = auxDIBImageLoadA ("filename.bmp");

Before calling exit (0), I delete my textures with :

LocalFree(texture);

Is this enough ? Should I better free texture -> data ? And if the texture was stored in the accelerator card 's memory,
will it really be deleted ?

Please help !

DaViper
06-12-2001, 12:11 AM
glDeleteTextures.....

Bob
06-12-2001, 08:19 AM
Unless your displaydrivers are corrupt, you shouldn't have to delete the rendering context nor the textures. The driver will automatically delete it. Same goes for all unallocated system memory, the OS will free it for you (when closing the program that is) if you forgot to do it. No memory leaks should occur because you forgot to free something. The driver or the OS takes care of it.