What is "Access Violation"?

When I run my OpenGL application I sometimes get this writtin 8000 times in the debug window:

First-chance exception in Game.exe (GDI32.DLL): 0xC0000005: Access Violation.

What does it mean?
How do I fix this error?

Thanks.

It means you’re probably passing some bad pointer value to some GDI function… somewhere in GDI32.DLL it is accessing bad memory.

You fix it by not doing that!

yup…some pointer must be NULL

Nope. This is actually a bug in the GDI in Win9x. You can safely ignore it (even Quake3 produces those same access violations when run in the debugger).

[This message has been edited by DFrey (edited 04-12-2001).]

Heh.

I’m so glad I’m not a Winblows programmer…

If it is so safe to ignore it why is it making the framerate drop of about 40 fps?

Originally posted by Gabriel:
If it is so safe to ignore it why is it making the framerate drop of about 40 fps?

On what do you base this assumption??

I’ve never gotten that error…is it nVidia hardware spesific or something? (I run a radeon 64mb vivo + thunderbird + win98)

I get it sporadically. GF2 MX board. The debugger doesn’t seem to choke, so I dunno where it’s coming from. I’ve ignored it and it doesn’t seem to affect performance (aside from all the damned messages spitting out.)

No, it’s not NVidia specific. I’ve seen it many times with the MS and SGI software renderers. It’s a GDI bug and appears pretty much at random. (To the point where it sometimes happens and sometimes doesn’t, even with the same build.

Gabriel - I think the performance hit you’re seeing is caused by MSVC’s handling and reporting of the exception, not the exception itself. I’ve never been affected by it when running an app standalone.

You are right Mike,
Thank you very much.

That was bugging me for months and I must admit that I never took the time to compare speed of an application from in and out of msvc debuger…

Sorry every body…

Ok, I thoughth this wouldent come up in a advanced forum, but every ones got the right Idea. I might fill in the gaps though…

(I teach this ****, so heres what I tell my students)

when u get the first chance acess violation try rebuilding(rebuild all) the code. If problem persists You probabley have a minor pointer problem (a reference to invalid memory).

If the message repeats the pointer problem is stuck inside a loop.

The out put to the degug window and the failing of assurtions that cause this is what will slow down the frame rate. This is becuase it is taking up execution time.

generaly people who structure there code well, avoid the first chance eception stuff caused by the compiler.

If you do a" release build" you will not be effected by this.

this problam is not nvida specific its not even opengl specific, it not even win32 specific,
anything produced by msvs / msvc can have this.

Sorry duckman, you obviously are not familiar with the bug. This particular access violation is in Microsoft’s GDI code. It sporadically occurs on Win9x machines when debugging OpenGL code. It is not a result of any error in one’s OpenGL program. Any OpenGL program run in the MSVC debugger will, seemingly randomly, produce thousands of these access violations or none.

Yes I am aware of the bug (Its a very common one after all)

Ive also seen the problem out of the gdi context (even in console apps)

but it isn’t the only thing that can cause the problem.
(Thats what I was trying to get across)