PocketMatrix forums

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

Stack errors again on PPC only (works on PC)

see update below first as I seem to have found what's wrong:-
Dan gave me advice a few weeks ago re: tracking down an exception violation 0xc0000005 and pointed to stack size as my problem. At that time I changed a few globals to be local variables & the errors went away but now even when I increase the stack size throught the project settings to 4Mb or greater I still get crashes on PocketPC. When I reduce some of my arrays of structs created via new by large amounts the problem still happens but only after the game has run for a bit. This is odd because by doing this I should be cutting the game's memory usage by far more than any extra variables added in the past few weeks.

When I run under debug I get a first-chance exception & it's deep inside PocketFrog somewhere.

Anyway, how big can the stack be on PocketPC? also any ideas on how to nail this for good would be welcome.

ps: could this be allignment & not stack related?

Update: Well it seems to be a UNICODE text issue. The major feature I added a few weeks back was the trade goods & the PC text file was being correctly read both on PC and PPC. Looks like I'm doing something wrong now though. When I converted the text file to unicode the game runs fine but the text is missing so no crashes now. I just need to determine if there is an issue with using a single ascii file or not. If so I will just alter so PPC deals with the unicode data. ( but why did it work for a time ???)
0xc0000005 is an address exception, IIRC - i.e. you're writing/reading to/from memory that's not properly allocated - this is usually the result of something like a null-pointer exception.

Note that this is a different error to the 80000002 you had before (that's an alignment issue).

Put asserts on all of the parameters you're sending to PF and figure out where the address the exception passed back is.

Anyway, if you're using new to create an array of structs using new, the structs are created in the heap, not on the stack (ISTR at least). To my knowledge, anything using "new"/malloc is in the heap, and any variables declared locally are stack-based.

E.g.:
Code:
struct Fish { int flippers;};

main() {
Fish my_fish; // Stack
Fish *another_fish;
another_fish=new Fish; // Heap
...
}