PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Game crashes on very last line ( return 0)

When I exit from my in-development game I get an exception with error number -1073741819
This happens on the ARM release, the VC6 Debug but not the VC6 release version.

I'm guessing that it's something to do with not releasing memory but I have delete'd everything I new'ed. Does anyone have any pointers ( no pun intended )

for example my main arrays are created like this :-
system_data *systems;
systems = new system_data[MAX_SYSTEM];
and deleted with:-
delete systems;
when you delete arrays allocated with new you have to use delete [] varname...

Code:

system_data *systems;
systems = new system_data[MAX_SYSTEM];
delete [] systems;


Hope that it helps.
Conan · 11 Mar 2003, 18:41 UTC — debugging continued
Thanks, I needed to know that & have now implemented []. It does not stop the crash however. I did get my VC6 debug build to stop crashing by removing one of the delete's so it may be that there's more stuff in there that's wrong.

I also get asked for the path to DBGDEL.CPP which I can't find on my VC6 or eVC setup.
Conan · 11 Mar 2003, 20:28 UTC — Pixel shader demo also crashes
I can also get the recently posted Pixel Shader demo to crash with the same error if I hit a hard button while the Frog splash screen is active. This means the problem is more generic than I thought. May be something like the Shutdown() problems I once had.
First of all, I would like to point out that (as with almost all other operators) the delete [] can also be written as delete[].

Then, here's what I think is wrong with your code. -1073741819 is the same as 0xC0000005 which is the "access violation" error code. And since the debugger fails during a delete (This is why it asks for the dbgdel.cpp. It wants the debug information for the delete function.) there are two possible scenarios:

1. You are using threads and forgot to link your project to the MT version of the runtime library (CLIB). If the single thread version of the runtime library is used with multiple threads that use new and delete you will get race conditions since they will all use the same heap to allocate/deallocate memory. On my platform SDK for eVC however, I only have one library to link to (=CE Runtime) and I think it's the same for all WinCE platforms. This library is an MT library so this can't be the problem.

2. You used the pointer (or array) to write outside the allocated memory area. Sometimes the debugger doesn't report this as an access error until you try to delete the array and this is what I think happened.

So, take a close look at your code and double check every access to the array that caused the error. My bet is that you used an illegal array index somewhere.
Conan · 12 Mar 2003, 07:48 UTC — thanks for the advice
Thanks Adde, you may be correct with the secord suggestion. If so this may mean that somewhere either PF or my own code is being naughty with arrays. I will find out how best to debug this kind of problem & get on it.
Kzinti · 12 Mar 2003, 07:54 UTC — thanks for the advice
Conan wrote:
Thanks Adde, you may be correct with the secord suggestion. If so this may mean that somewhere either PF or my own code is being naughty with arrays. I will find out how best to debug this kind of problem & get on it.


PF doesn't contain a single array... I stopped using em a long time ago. =)
Also make sure you're not deleting/destroying the same memory twice (second time it'll very likely go "bang").
Conan · 17 Mar 2003, 08:37 UTC — problem fixed
Having ensured all my delete's etc were fixed I still had the error until I moved the location of Shutdown() to be the very last statement in my main game loop ???

Now everything builds ok on PC and PocketPC so I can get back to the game.