RandyGaul/qu3e

VS 2013 stack overflow

stevensona opened this issue · 5 comments

Compiling on Visual Studio 2013. Program compiles 64-bit, but fails at the start of main with the following code:

#include "q3.h"

int main()
{
    q3Scene scene(1.0 / 60.0);
}

"Unhandled exception at 0x00007FF70F992E27 in program.exe: 0xC00000FD: Stack overflow (parameters: 0x0000000000000001, 0x0000003329403000)."

I just built with x64 MSCV 2013 and run the demo in debug/release mode without a crash. Can you give any more information than this, perhaps a stack dump?

On a hunch, I moved my declaration and initialization of the q3Scene object to outside main, and I no longer have the issue. Just for info though, VS code analysis with simple program listed above shows the following issue "C6262 Excessive stack usage Function uses '20971784' bytes of stack: exceeds /analyze:stacksize '16384'. Consider moving some data to heap. breakfast main.cpp 3". Not helpful, but heres the callstack.
callstack

I think that's because the q3Scene object should not be stack-allocated. It seems to be too large for the stack to handle?

That is clear now, but I believe there should be a note in the documentation. I'll submit a pull request later.

Internal stack implementation changed so this should no longer be a problem.