GAH! WTF?

Started by
25 comments, last by d000hg 19 years, 8 months ago
My programming life just went from fine to horrible in about 5 minutes. This is what happened. 1. Started MSVC7 and loaded my game. 2. Coded some new code. 3. Noticed that my new code gave me a weird asm error and took it out. 4. Tested my code in the state where it was a day ago when it worked and still got the error. 5. Pasted in my code from two days ago and still got the error. 6. Restarted and still got the error. And here's the error: First-chance exception at 0x00512a15 in shooter.exe: 0xC00000FD: Stack overflow. Unhandled exception at 0x00512a15 in shooter.exe: 0xC00000FD: Stack overflow. It then takes me to an asm file called chkstk.asm and gives me this code: The fourth line is the line it says is the error. probepages: sub ecx,_PAGESIZE_ ; yes, move down a page sub eax,_PAGESIZE_ ; adjust request and... test dword ptr [ecx],eax ; ...probe it cmp eax,_PAGESIZE_ ; more than one page requested? jae short probepages ; no I'm not very good at techinical things like this, I've only been programming in c++ for a few months, its just that I had 4+ years of prior experience in java, vb and basic so I've been able to make alot of progress.
Bugboy
Advertisement
Try a clean rebuild from nothing. Sometimes that's all it takes.

Also, I would add that even if you're just working on a project by yourself, having some kind of source revision control can be a complete and total lifesaver. I put all my projects on sourceforge and use TortoiseCVS to manage it and I never have to worry about changes that may have broken something because I always have a revision history to look at. It's saved my bacon many, many times.

your overflowing your stack, check your functions maybe one has a huge array defined or something (place it on the heap [global] or malloc it). Or try a complete rebuild.
Rebuild didn't work. I did notice that when I changed the number of an array it worked up to the main loop instead of crashing before the window even appeared. But the array was tiny, I was changing it from 5 to 1.
Bugboy
Try to make sure you're not using recursive functions that can go down to huge depths, and that you're not returning functions, as this is the same thing as recursion although people sometimes don't see it. Other than that all I can suggest is setting a few breakpoints to find out more about where things are going wrong.
Are you using any recursive functions? That could also be the source of a stack overflow if the recursion goes too deep.
.
Post a topic with a good titile next time and I'll post a reply with a good answer.

NOTE: no one can guess this without seeing any code or having any idea what you changed.
Using breakpoints it seems that the error is starting at the function that updates the enemies. I commented it out and now the error happens again at the function that updates bullets. So I kept on going and commented out a bunch of stuff and now it apparently does one loop before giving me the error somewhere else.

I'm pretty sure that none of my functions are recursive. Maybe I should try sending someone my code and seeing if it works on their comp.

I think the real question should be why does code that ran perfectly a few days ago give me a error today?
Bugboy
Are you certain the compiler settings haven't been accidently or unexpectedly set to make the requested stack space smaller than usual? I would try your code, but I only have MSVC++ 6.0 and the 8.0 Express Beta.
.
I can't figure out how to change the requested stack space and yes i have googled.

If you told me what you do in MSVC6 then I could probably figure it out.
Bugboy

This topic is closed to new replies.

Advertisement