View Full Version : Strange Acess Violation Exception on glPopAttrib

12-01-2010, 02:02 PM
Hi all,

I've got a strange crash in my program. I am getting access violation exceptions that (in the VS debugger) show up on a glPopAttrib() call, which allways follows a glPushAttrib(GL_ALL_ATTRIB_BITS). The call stack appears to be following a call to glFlush().

I've just gone through my code and wrapped any calls to any pointers with assert(obj != NULL), and the few deletions I do are followed by ptr = NULL. I really am not sure how I am accessing out of bounds memory.

The crash only happens when the system is left running for 10-20 minutes.

Does anyone have any ideas. Sorry if the explaination is poor.


Arkaid D.
12-01-2010, 04:11 PM
It's hard to say what might be causing the problem without a thorough look at your code. And even with it, it would still be hard to point out without debugging it. But it looks like a classic memory leak problem to me. Something is corrupting your memory little by little until it starts eating OpenGL's memory space. Then, when glPopAttrib is called, the corruption happens.

Re-check your code for anything that can cause a memory leak (undeleted pointers, out of bound arrays, etc). A quick way to verify that the leak is happening is to bring up the task manager and see if your application is constantly growing in its memory usage.

12-01-2010, 05:16 PM

An update if the ATI drivers seems to have fixed the problem. I'll have a good scan of my memory management just in case this has just made the symptomn of a bigger problem go away.



12-01-2010, 06:55 PM
I've read about these Push/Pop things and supposedly it's better not to use them, since they run on the CPU. To replace them use your own scheme, or no stack at all.