Skip to main content
gamedev.net
🔒 Locked

Cause for Access Violation?

Started by Esap1 Jun 26, 2000 at 11:01 PM 9 replies 450+ views
Original Post
Esap1
Esap1
Whats the cause for an Access Violation, Well thanks, later,
mhkrause
mhkrause
Your program attempted to access memory it does not have access to.

This could be caused by:

Using a NULL pointer.
Using an invalid pointer.
Using a free pointer.
Going past array bounds.

If you use MSVC, usually a message box will come up giving you the option to debug the program. This will take you to the exact line causing the error.
Shannon Barber
Shannon Barber
You poked a hole that didn''t like being poked
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Esap1
Esap1
It took me to ASM code, so Im thinking its not in my code. The Address was 0xC000005, is that common(just seems like its a too simple of a number to be random).Any idea''s to debug. Ive narrowed it down to about a 250 line function that loads an ASE file. Any idea''s for debugging would be great, thanks,
Esap1
Esap1
Oh, woops, new that address looked to perfect
Esap1
Esap1
Well any help with the other questions?
Qoy
Qoy
What are you using for debugging? If you''re using an actual debugger, then it will probably take you to the correct line if you run the game (or whatever) from within the debugger. If you are using some kind of simple output (like the debug window, a file, monochrome monitor, or whatever) then you should probably put an output call near the end of the function and near the beginning, and if it gets to the beginning but not the end, then that''s where your error is. If that''s so, then keep moving the calls inward (toward the center of the function) until you narrow down the exact line that it doesn''t make it past.

Just my suggestions.
Esap1
Esap1
Oh golly, Im going to have to use some real debugging tools now since I got these two computers on a network I was hoping VC++6.0''s debugger could help in some way, as I dont know much on using it, well thanks for the suggetion, I guess Ill right to a file over the network then check it while its running on the other computer, and I should be able to figure out which line, but not till morning later,
Shannon Barber
Shannon Barber
Every program should have a good ''Press on regardless'' philosophy

Build your program and wap on F10, step-over the commands until it blows up. Repeat, except this time hit F11 (step-into) on the line that blew up. Repeat until you find your error. (Destructors get called on the ''}'' of a scope, you may need to set break points inside the destructors in order to debug those)
If your program is full screen you need two monitor (and two video cards) to debug...

Watch all your pointers, access violation often means a null pointer, or maybe an unitialized one. There some issuses with the lifetime of a variables that you may think should work, but don''t. Like pointing to the return value of a function or something silly like that...
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.