I am using push/pop matrix and I appear to have a memory leak.

Maybe I am not calling a pop or something. Is there a way to destroy matrices that you build up? I am building on NeHe examples and using VB. In my DrawGLScene function I push a mtrix several time. I am not dumping all of my memory when I stop the program, well in VB environment anyway. How can I stop my program from eating away at my memory like that. I am talking 1 MB of memory every ten seconds. Good thing I have 2GB.

If you call PushMatrix()/PopMatrix() in pairs then you won’t have any leaks (unless the driver is buggy). If you don’t have the correct pairing then you will get GL_STACK_OVERFLOW errors quite quickly.

Perhaps if you post some code someone might be able to see the error?

I found my leak! First of all, don’t create a new glu quadric more times than you have to. Especially don’t do it in a loop. In my function drawglscence, I took out all the variable declarations and made them globals. This appears to work.

I’m don’t understand. Was it you who wasn’t freeing memory or glu?

well as you guys know, you have to create a glu quadratic if you want to use opengl to draw a cylinder or a sphere or whatever else you can draw with it. Anyway, if you create a gluquadratic in a function it is not destroyed at the end of the function. So each time you call that function memory is allocated and never reclaimed. This can really add up as was the case in my program. I was adding a meg of ram every ten seconds.