• Advertisement

Archived

This topic is now archived and is closed to further replies.

Cause for Access Violation?

This topic is 6448 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Whats the cause for an Access Violation, Well thanks, later,

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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,

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
0xc0000005 is not the address, it''s the exception code, which is access violation.

Share this post


Link to post
Share on other sites
Oh, woops, new that address looked to perfect

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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,

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Three words.

Structured Exception Handling.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites

  • Advertisement