Hey Guy's...Need you help on this one!! " Memory Access Violation " ???

Blitz3D Forums/Blitz3D Programming/Hey Guy's...Need you help on this one!! " Memory Access Violation " ???

Kozmi(Posted 2003) [#1]
Hi All,

Im' kind'a inbetween a rock & a hard place here...
Im' working on the terrain size option in QoolEdit ( Terrain Editor ) and the initial opening screen comes up fine when asking the user what size terrain they want and you can make your selection with no problem on that window!
However though.. In my code, on the second window.. It has the option to create a (New) terrain by clicking the (New) options button in the pop-up menu of QoolEdit! The problem im' having is that I use the " FreeEntity " command to clear out the terrain entity from memory and then I create a new terrain using the same varible name called: 'terrain'.
However though! When I go and disable the " FreeEnity " command using a quote mark in my code and then run the program again... When I go to select the (New) button again.. Everything seems to be fine expect that now the terrain ofcourse is still there and it seems like the options on the terrain size menu are not functioning at all!

But as soon as I re-enable the " FreeEnity " command again,
It comes up with " Memory Access Violation " again...It usauly afterwards it crash's my computer!!! Im' using Jeppe Nielson's BBGui for my Gui-based windows in my application program. And Blitz3D doesn't seem to have any documention explaining why the error is being caused and such...If I had a point to start at to help me track down the source causing this error...I could have a better chance at solving it! Does anybody here have any suggestions for me on this one? Any help would be greatly appreciated very much so...

Thank's again to all on this forum for your help many of times!


jfk EO-11110(Posted 2003) [#2]
might be a silly question, but did you turn Debug on?


Kozmi(Posted 2003) [#3]
Yep tried that one already and havn't found the problem!!!


jfk EO-11110(Posted 2003) [#4]
terrains are still blitzes problemchild. they act very strange in many aspects.

try to track down your bug by running parts of the code and find the line that in fact produces the error.


Kozmi(Posted 2003) [#5]
@ jfk and everybody on here...

I had a stupid attack all over me tonight...
I just found the problem.. It appears to be that I was removing the entity before it's time you might say!!
I mean duh...!!! If there isn't a entity when you goto access it...Thus it will produce ( If Debug isn't on!! ) a " Memory Access Violation " due to no entity being there!!!

When Debug is enabled... It becomes an " Entity does not Exist! " Error...

Im' sorry guys!! I've not been thinking straight this week!

Thanks anyways!!! Still having trouble though with trying to smooth my terrains! I would like to smooth them in real time like the CSP Terrain editor does... But I use Heightmaps vs. It using raw data to construct it's terrains!

If anybody can figure this one out on the smoothing of terrains using heightmaps in real time.. then let me know! Or if someone that is up for a challenge and would like to help me out with this, Id' greatly appreciate it very much so!! Many thanks again to everybody and please excuse me today...I've not been feeling like myself!


John Blackledge(Posted 2003) [#6]
I get " Memory Access Violation " quite often on a compiled exe with Debug switched off. Run it again and it's fine.
Very embarassing when showing friends. It's as if the graphics card crashes cause it's not ready for a Graphics3D change, then just doouble-click and run again and it's fine.
Any ideas?


Kozmi(Posted 2003) [#7]
Have you updated your video card's drivers lately?
Or you might check your system files to see if any of them have been changed or updated in some way or possibly deleted files that needs to be restored again...

Just a thought!

What video card do you have in your system anyways?!?


Anthony Flack(Posted 2003) [#8]
DrWho, what you should do in future is this:

If terrain<>0 then terrain=0:freeentity(terrain)

Nice 'n' safe.


jfk EO-11110(Posted 2003) [#9]
Anthony - I bet a sixpack beer this will produce an error. you cannot set the handle to zero and then free the handle!

Do it visaversa:

if terrain<>0 then
freeentity terrain
terrain=0
endif

where did you get those pills from ? :P


(tu) sinu(Posted 2003) [#10]
@AF your way would just free 0 and leave the terrain still onscreen with no handle.


Gabriel(Posted 2003) [#11]
Just a typo, it should be the other way around, that's all.


jfk EO-11110(Posted 2003) [#12]
Of course. just found it funny because of the "nice'n'safe" :)

Reminds me of my "glory" release of a RC4-Encryption Tool, and some weeks later i realized there was a bug that made it encrypt with a single Byte-XOR. THAT was safe :) Thanks to PANNO btw. his code was ok, I just forgot to make some vars global when I implemented his Algo (code archives) in my Gui.


WolRon(Posted 2003) [#13]
I wonder how Anthony wrote Platypus...


John Blackledge(Posted 2003) [#14]
"Have you updated your video card's drivers lately?
What video card do you have in your system anyways?!? "
Nah, this happened on a GeForce 2, and now a GeForce 4, latest drivers installed. Only happens in full-screen, though. It's as if the card isn't ready to accept any graphics commands at that time, 3 secs later it's ok.
Is there a test that I can apply that can query if the card is ready? Is it flipping from Desktop res to the chosen Graphics3D mode that's doing it? Any answers would help. (Btw a fair few people have remarked on this over at Blitz Coder, they shrug and rerun, but it is embarrasing when you're asking friends to test your world-beater.)


eBusiness(Posted 2003) [#15]
If you use reals to store handles they will sometimes be wrong, as your handle isn't necessarily the same each time you run the program it will only fail sometimes. But it could probably also be a thousand other issues.


John Blackledge(Posted 2003) [#16]
Nah, it's when the Graphics3D mode is changed, or the first other graphics call (e.g. Line x1,y1,x2,y2). Is no-one else having this problem (excellent, if it's be not my fault!). Sorry. I seem to be hijacking this thread.