memory access violations

Blitz3D Forums/Blitz3D Programming/memory access violations

John Blackledge(Posted 2004) [#1]
"memory access violations".
I see this a lot. But never windowed.
If running full screen you can guarantee that it will happen 50% of the time when I first run my program.
I've put error reporting in every few lines, and Blitz appears to correctly create the window, and can e.g. report it's width.
But the next graphics call, even a Line call, will cause the error.
So much so, that I've had to hack into the runtime dll and replace the words "memory access violations" with "Problem, please restart the program" (which always works fine) - else what normal user is gonna know what m.a.v. means!


WolRon(Posted 2004) [#2]
The end user will soon get sick of restarting the program even with your polite message, so you have accomplished nothing.

Split your program in half, or parts and see which part is causing the MAV. Then break it down furthur........


Damien Sturdy(Posted 2004) [#3]
Ere, my programs not even giving a MAV- it just closes. no error, no report... :?


aab(Posted 2004) [#4]
Memory Access voilations are pretty serious, and usually mean that youve eg: tried to scale a mesh at the memory address of an image or the program your using or even explorer or somewhere randomly out there etc.

I think "Problem, please restart the program" 's a bit of a troublemaker to put in..
Wierd how it isnt happening in your case in Windowed mode..


puki(Posted 2004) [#5]
'memory access violation' seem to have multiple causes though - I wonder if anyone has ever catalogued them. Some of the causes are due to really simple programming errors, but a real bummer to find manually in the code - some will manifest at a certain point in the program, ie, you won't get a run-time error.

Maybe there should be a thread somewhere where we can catalogue stuff as we find it which caused 'memory access violations' - it would give people a checklist of things to look for in their program.


GfK(Posted 2004) [#6]
"Memory Access Violation" is a generic error message which you tend to get only in "Release" mode, not "Debug". Pretty much any error in a compiled exe will throw a MAV.

Switch Debug on and you'll get a more meaningful error message.


John Blackledge(Posted 2004) [#7]
Sorry, you're _all_ missing the point.
1. Never happens in windowed mode.
2. Debug produces _nothing_ at all.
Please re-read this:
"Blitz appears to correctly create the window, and can e.g. report it's width. But the next graphics call, even a Line call, will cause the error. "
In other words the _next_ graphic call of any kind (nothing so sophisticated as a resize) will cause the mav.
Then I re-run the program, and everything's fine.
It's as if the first (and only the first) initialisation of 3D mode causes this, but try explaining _that_ to the user.


skidracer(Posted 2004) [#8]
Has this behavior been reported on other systems or just your own?

Have you tried removing all your userlibs?

Does it happen with the standard Blitz3D demos?

Given you have reported problems with movies / sound have you tried disabling your audio device to see if this makes any difference?


John Blackledge(Posted 2004) [#9]
I guess that nobody is getting this problem (as I have described it). Therefore, as you say, time to track down what it is on my machine. (Sigh) - Tedious.


HappyCat(Posted 2004) [#10]
I'm getting exactly the same problem. Runs fine from the IDE (debug or otherwise) but once I create an .exe the first run always fails with a MAV. Second run (and thereafter) works fine.

And it happens on both my work desktop PC (Windows 2000) and my laptop (XP SP2), so I doubt it's drivers (as they have completely different hardware).

Edit: Done a bit more experimenting and it appears to only happen when I compile the .exe from within Protean and answer "Yes" when asked to run it. If I answer "No" and run the .exe from Explorer then it works fine. Oh well, panic over.


John Blackledge(Posted 2004) [#11]
Initially, Happycat, you were correctly exactly describing my problem. But I'm using the Blitz compiler, so the fault is not Protean's.